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

Leon Romanovsky posted 21 patches 2 months, 2 weeks ago
[RFC v2 21/21] nvme-pci: don't allow mapping of bvecs with offset
Posted by Leon Romanovsky 2 months, 2 weeks ago
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 --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