[PATCHv3 1/2] nvme-pci: fix dma_vecs leak on p2p memory
Christoph Hellwig
hch at lst.de
Thu May 21 01:21:53 PDT 2026
On Wed, May 20, 2026 at 10:49:52AM -0700, Keith Busch wrote:
> From: Keith Busch <kbusch at kernel.org>
>
> We don't unmap P2P memory, so allocating the dma_vec for it was being
> leaked on completion.
>
> Fixes: b8b7570a7ec87 ("nvme-pci: fix dma unmapping when using PRPs and not using the IOVA mapping")
> Signed-off-by: Keith Busch <kbusch at kernel.org>
> ---
> 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 139a10cd687f9..744b388eea956 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -966,7 +966,8 @@ static bool nvme_pci_prp_save_mapping(struct request *req,
> {
> struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
>
> - if (dma_use_iova(&iod->dma_state) || !dma_need_unmap(dma_dev))
> + if (dma_use_iova(&iod->dma_state) || !dma_need_unmap(dma_dev) ||
> + iod->flags & IOD_DATA_P2P)
Missing braces around the & for our usual style?
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch at lst.de>
More information about the Linux-nvme
mailing list