Skip to content

Commit

Permalink
nvme-pci: fixing memory leak in probe teardown path
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Irvin Cote <irvincoteg@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Irvin Cote authored and Christoph Hellwig committed Mar 15, 2023
1 parent 37f0dc2 commit a61d265
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/nvme/host/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -3073,6 +3073,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
nvme_dev_unmap(dev);
out_uninit_ctrl:
nvme_uninit_ctrl(&dev->ctrl);
nvme_put_ctrl(&dev->ctrl);
return result;
}

Expand Down

0 comments on commit a61d265

Please sign in to comment.