diff mbox series

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

Message ID 63cdbb87e1b08464705fa343b65e561eb3abd5f9.1726138681.git.leon@kernel.org (mailing list archive)
State RFC
Headers show
Series Provide a new two step DMA API mapping API | expand

Commit Message

Leon Romanovsky Sept. 12, 2024, 11:15 a.m. UTC
From: Leon Romanovsky <leonro@nvidia.com>

It is a hack, but direct DMA works now.

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

Patch

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;