From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 118EF1ED38 for ; Tue, 25 Jul 2023 11:29:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85E4AC433C7; Tue, 25 Jul 2023 11:28:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1690284539; bh=xIYpv/5AJ5YqVdGxf9iOMsIix6UeNRJiJdlHEwEm6+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jP8qC75InMiOFSf48Ao+noBD2RYzvOCvgdYJMqOk/xvqZKHbq6/wrmpfcC5b2u+iA PoKSsbOHAb5+6jFVymvpCfMIn633bFx44O1xL5EiReW7FglS381CMvgs6mDj4xX6Hh gxqFMDC87JRTRp448+LTfv3ECu3wo67pYF/95a+Y= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Guangwu Zhang , Ming Lei , Christoph Hellwig , Keith Busch , Sasha Levin Subject: [PATCH 5.10 375/509] nvme-pci: fix DMA direction of unmapping integrity data Date: Tue, 25 Jul 2023 12:45:14 +0200 Message-ID: <20230725104610.896927027@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230725104553.588743331@linuxfoundation.org> References: <20230725104553.588743331@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Ming Lei [ Upstream commit b8f6446b6853768cb99e7c201bddce69ca60c15e ] 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: Guangwu Zhang Fixes: 4aedb705437f ("nvme-pci: split metadata handling from nvme_map_data / nvme_unmap_data") Signed-off-by: Ming Lei Reviewed-by: Christoph Hellwig Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index c47512da9872a..3aaead9b3a570 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -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); -- 2.39.2