[PATCH] NVMe: Fix 0-length integrity payload

Sagi Grimberg sagig at dev.mellanox.co.il
Tue Feb 23 09:11:52 PST 2016


> A cheeky user could send a passthrough IO command with a metadata pointer,
> but on a namespace without metadata. With metadata length of 0, kmalloc
> returns ZERO_SIZE_PTR. Since that is not NULL, the driver would have
> set this as the bio's integrity payload, which causes an access fault
> on completion.
>
> This patch ignores the users metadata buffer if the namespace format
> does not support separate metadata. This is preferred over returning an
> invalid error to work with existing user space applications.

So having user-space get it wrong forever is preferable? Although I
assume that this is the equivalent of a strip operation which is
perfectly valid. The one difference is that strip validates the meta
data by definition...

If you want to be extra pedantic, you can verify that the meta-data is
still valid, but given that the data didn't travel the pci I don't know
if it makes real sense...

So all-in-all this looks fine,

Reviewed-by: Sagi Grimberg <sagig at mellanox.com>

CC'ing mkp



More information about the Linux-nvme mailing list