[RFC v2 21/21] nvme-pci: don't allow mapping of bvecs with offset

Leon Romanovsky leon at kernel.org
Thu Sep 12 04:15:56 PDT 2024


From: Leon Romanovsky <leonro at nvidia.com>

It is a hack, but direct DMA works now.

Signed-off-by: Leon Romanovsky <leonro at nvidia.com>
---
 drivers/nvme/host/pci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 881cbf2c0cac..1872fa91ac76 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -791,6 +791,9 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,
 			return BLK_STS_RESOURCE;
 
 		rq_for_each_bvec(bv, req, iter) {
+			if (bv.bv_offset != 0)
+				goto out_free;
+
 			dma_addr = dma_map_bvec(dev->dev, &bv, rq_dma_dir(req), 0);
 			if (dma_mapping_error(dev->dev, dma_addr))
 				goto out_free;
-- 
2.46.0




More information about the Linux-nvme mailing list