Commit 13fb06c7 authored by Ming Lei's avatar Ming Lei Committed by Yong Hu
Browse files

nvme-pci: fix DMA direction of unmapping integrity data

stable inclusion
from stable-v5.10.188
commit f4ff3798123585c9c7dd48ab7ef169fb505e0774
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7PZZC

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.10.y&id=f4ff3798123585c9c7dd48ab7ef169fb505e0774



--------------------------------

[ Upstream commit b8f6446b ]

DMA direction should be taken in dma_unmap_page() for unmapping integrity
data.

Fix this DMA direction, and reported in Guangwu's test.

Reported-by: default avatarGuangwu Zhang <guazhang@redhat.com>
Fixes: 4aedb705 ("nvme-pci: split metadata handling from nvme_map_data / nvme_unmap_data")
Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarYong Hu <yong.hu@windriver.com>
parent 1813d41c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -968,7 +968,8 @@ static void nvme_pci_complete_rq(struct request *req)

	if (blk_integrity_rq(req))
		dma_unmap_page(dev->dev, iod->meta_dma,
			       rq_integrity_vec(req)->bv_len, rq_data_dir(req));
			       rq_integrity_vec(req)->bv_len, rq_dma_dir(req));

	if (blk_rq_nr_phys_segments(req))
		nvme_unmap_data(dev, req);
	nvme_complete_rq(req);