nvme-host: disk corruptions when issuing IDENTIFY commands via ioctl()

Christoph Hellwig hch at lst.de
Tue Mar 8 22:26:30 PST 2022


On Tue, Mar 08, 2022 at 05:45:20PM +0100, Maurizio Lombardi wrote:
> We suspect that the root cause is that the nvme-host driver doesn't
> enforce the 4096 byte limit for the IDENTIFY commands as the
> nvme-target does (see the nvmet_execute_identify() -->
> nvmet_check_transfer_len(req, NVME_IDENTIFY_DATA_SIZE) code).
> So if we pass a 8192-byte buffer not aligned to the page size, it will
> need 3 pages on archs where page size is 4k and the nvme spec says
> that the data buffer may not cross more than one page boundary.
> 
> Does it make sense to you? What's your opinion on this?

Combination of a broken application (does what the spec explicitly
tells it not do) and broken hardware (does the most stupid thing when
fed invalid input), not much the driver can do here.  But we really
should talk to the nvme working group to ECN the text for the single
PRP requirement to spell out the consequence in more detail, and maybe
also mandate how it is handled for the next spec version.



More information about the Linux-nvme mailing list