nvme-pci: fixing memory leak in probe teardown path
A message that is not in the archive (sent off-list or not yet received): Y/lmo9yfA1w0+Bp2@archlinux
PATCH 1/1 nvme-pci: fixing memory leak in probe teardown path
---------- Forwarded message ---------
From: Irvin Cote <[email protected]>
Date: Fri, 24 Feb 2023 at 22:38
Subject: [PATCH] nvme-pci: fixing memory leak in probe teardown path
To: <[email protected]>
Cc: <[email protected]>, <[email protected]>, <[email protected]>
In case the nvme_probe teardown path is triggered the ctrl ref count does not reach 0 thus creating a memory leak upon failure of nvme_probe
--- drivers/nvme/host/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/pci.c +0 -0
@@ -3072,6 +3072,7 @@ static int nvme_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
out_dev_unmap:
nvme_dev_unmap(dev);
out_uninit_ctrl:
+ nvme_put_ctrl(&dev->ctrl);
nvme_uninit_ctrl(&dev->ctrl);
return result; }
--
2.37.2
Sagi Grimberg
maintainerQuoted 21 lines
From: Irvin Cote <[email protected]>
Date: Fri, 24 Feb 2023 at 22:38
Subject: [PATCH] nvme-pci: fixing memory leak in probe teardown path
To: <[email protected]>
Cc: <[email protected]>, <[email protected]>, <[email protected]>In case the
nvme_probeteardown path is triggered the ctrl ref count does not reach 0 thus creating a memory leak upon failure ofnvme_probeSigned-off-by Irvin Cote <[email protected]>--- drivers/nvme/host/pci.c | 1 + 1 file changed, 1 insertion(+)drivers/nvme/host/pci.c +0
-0
drivers/nvme/host/pci.c static int nvme_probe(struct pci_dev *pdev, · line 3077
Quoted 6 lines
drivers/nvme/host/pci.c +1
-0@@ -3072,6 +3072,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) out_dev_unmap:nvme_dev_unmap (dev ); out_uninit_ctrl: +nvme_put_ctrl (&dev->ctrl);nvme_uninit_ctrl (&dev->ctrl);
I'd reverse the order. But looks good.