From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E95AC6FA1 for ; Mon, 3 Apr 2023 14:45:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BB80C4339B; Mon, 3 Apr 2023 14:45:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680533105; bh=9v6fPcXoHqX2UYXzCOsQOtq2Xoz/bLwl3a0T8ElP0JA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RPTZfL7P6dHCeW3kCMXGjyArc/G2/LhIN8hj/PRUr5Ah6FXpxfVNm56CH5uBXHeb6 BWVxMGmz2mDo94lx1CtWsH9Cdqjnp4IyWbZWdP6hkxdjFxhZPDJzIXYkOx26XpT3oN uAWp3O5U2EQoMhY0CS6olvWXgV5EU2Zf53PLZTyg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Irvin Cote , Christoph Hellwig , Sasha Levin Subject: [PATCH 6.2 049/187] nvme-pci: fixing memory leak in probe teardown path Date: Mon, 3 Apr 2023 16:08:14 +0200 Message-Id: <20230403140417.596536916@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403140416.015323160@linuxfoundation.org> References: <20230403140416.015323160@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Irvin Cote [ 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 Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 29c902b9aecbd..c51ebbee8103e 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -3126,6 +3126,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; } -- 2.39.2