]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nvme-pci: fixing memory leak in probe teardown path
authorIrvin Cote <irvincoteg@gmail.com>
Wed, 8 Mar 2023 21:05:08 +0000 (18:05 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Apr 2023 10:12:29 +0000 (12:12 +0200)
[ Upstream commit a61d265533b7fe0026a02a49916aa564ffe38e4c ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/pci.c

index 29c902b9aecbd49b91549b66d2613e1dd76dd9c3..c51ebbee8103e875dfe9f4395eda0ea86b889ce6 100644 (file)
@@ -3126,6 +3126,7 @@ out_dev_unmap:
        nvme_dev_unmap(dev);
 out_uninit_ctrl:
        nvme_uninit_ctrl(&dev->ctrl);
+       nvme_put_ctrl(&dev->ctrl);
        return result;
 }