[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250224074313.2958696-1-haoxiang_li2024@163.com>
Date: Mon, 24 Feb 2025 15:43:13 +0800
From: Haoxiang Li <haoxiang_li2024@....com>
To: airlied@...hat.com
Cc: dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
Haoxiang Li <haoxiang_li2024@....com>,
stable@...r.kernel.org
Subject: [PATCH] agp: Fix a potential memory leak bug in agp_amdk7_probe()
Variable "bridge" is allocated by agp_alloc_bridge() and
have to be released by agp_put_bridge() if something goes
wrong. In this patch, add the missing call of agp_put_bridge()
in agp_amdk7_probe() to prevent potential memory leak bug.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@...r.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@....com>
---
drivers/char/agp/amd-k7-agp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index 795c8c9ff680..40e1fc462dca 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -441,6 +441,7 @@ static int agp_amdk7_probe(struct pci_dev *pdev,
gfxcard = pci_get_class(PCI_CLASS_DISPLAY_VGA<<8, gfxcard);
if (!gfxcard) {
dev_info(&pdev->dev, "no AGP VGA controller\n");
+ agp_put_bridge(bridge);
return -ENODEV;
}
cap_ptr = pci_find_capability(gfxcard, PCI_CAP_ID_AGP);
--
2.25.1
Powered by blists - more mailing lists