public inbox for linux-edac@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] EDAC/amd64: fix possible leak in hw_info_get()
@ 2022-11-10  2:52 Peng Wu
  2022-11-10 21:36 ` Yazen Ghannam
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Wu @ 2022-11-10  2:52 UTC (permalink / raw)
  To: yazen.ghannam, bp, mchehab, james.morse, rric
  Cc: linux-edac, liwei391, Peng Wu

Add missing kfree() in an error path in hw_info_get()
to avoid a memory leak.

Fixes: 80355a3b2db9 ("EDAC/amd64: Gather hardware information early")
Signed-off-by: Peng Wu <wupeng58@huawei.com>
---
 drivers/edac/amd64_edac.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 2f854feeeb23..b64b774eb974 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -4108,8 +4108,10 @@ static int hw_info_get(struct amd64_pvt *pvt)
 	}
 
 	ret = reserve_mc_sibling_devs(pvt, pci_id1, pci_id2);
-	if (ret)
+	if (ret) {
+		kfree(pvt->umc);
 		return ret;
+	}
 
 	read_mc_regs(pvt);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-10 21:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-10  2:52 [PATCH] EDAC/amd64: fix possible leak in hw_info_get() Peng Wu
2022-11-10 21:36 ` Yazen Ghannam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox