Re: [PATCH v2] nvme: Check the PRINFO bit and the Metadata size before deciding the host buffer length
From: Rajashekar, Revanth <hidden>
Date: 2021-01-13 16:58:01
From: Rajashekar, Revanth <hidden>
Date: 2021-01-13 16:58:01
Hi Christoph, Thanks for reviewing. On 1/12/2021 11:39 AM, Christoph Hellwig wrote:
quoted
@@ -1546,6 +1546,11 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) meta_len = (io.nblocks + 1) * ns->ms; metadata = nvme_to_user_ptr(io.metadata); + if (io.control & NVME_RW_PRINFO_PRACT && ns->ms == 8) { + meta_len = 0; + metadata = NULL; + } +Wouldn't something like: if ((io.control & NVME_RW_PRINFO_PRACT) && ns->ms == sizeof(struct t10_pi_tuple)) { /* * Protection information is stripped/inserted by the * controller. */ if (nvme_to_user_ptr(io.metadata)) return -EINVAL; meta_len = 0; metadata = NULL; } else { meta_len = (io.nblocks + 1) * ns->ms; metadata = nvme_to_user_ptr(io.metadata); } make a little more sense?
Yes! it definitely makes more sense. Will send out a v3 for this patch. Thanks! Revanth _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme