]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
nvme-pci: fix leak on sgl setup error
authorKeith Busch <kbusch@kernel.org>
Tue, 29 Jul 2025 18:12:47 +0000 (11:12 -0700)
committerChristoph Hellwig <hch@lst.de>
Thu, 31 Jul 2025 13:35:51 +0000 (06:35 -0700)
We need to free the descriptor that was allocated. We also don't
necessarily need to unmap each sgl entry, which was previously being
attempted unconditionally.

Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/pci.c

index 071efec25346fc8fb070ceceb8987c68f8117fce..2c6d9506b172509fb35716eba456c375f52f5b86 100644 (file)
@@ -935,7 +935,7 @@ static blk_status_t nvme_pci_setup_data_sgl(struct request *req,
 
        nvme_pci_sgl_set_seg(&iod->cmd.common.dptr.sgl, sgl_dma, mapped);
        if (unlikely(iter->status))
-               nvme_free_sgls(req);
+               nvme_unmap_data(req);
        return iter->status;
 }