EDAC/amd64: fix possible leak in hw_info_get()
Subsystems (2)
PATCH 1/1 EDAC/amd64: fix possible leak in hw_info_get()
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 <[email protected]>
--- drivers/edac/amd64_edac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/edac/amd64_edac.c +3 -1
@@ -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);
Signature · 1 line
2.17.1
Yazen Ghannam
maintainerQuoted 16 lines · Peng Wu
Add missing
kfree()in an error path inhw_info_get()to avoid a memory leak.Fixes 80355a3b2db9 ("EDAC/amd64: Gather hardware information early")Signed-off-by Peng Wu <[email protected]>--- drivers/edac/amd64_edac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/edac/amd64_edac.c +0
-0@@ -4108,8 +4108,10 @@ static int hw_info_get(struct amd64_pvt *pvt) }
drivers/edac/amd64_edac.c static int hw_info_get(struct amd64_pvt *pvt) · line 4117
Quoted 10 lines
drivers/edac/amd64_edac.c +3
-1ret =reserve_mc_sibling_devs (pvt, pci_id1, pci_id2); -if (ret) +if (ret) { +kfree (pvt->umc);return ret; + }read_mc_regs (pvt);
Hi Peng Wu,
Thank you for your submisssion.
This is already handled in the error path.
If hw_info_get() fails, then we jump to the "err_enable" label in probe_one_instance(). This calls hw_info_put() which frees the "umc" array.
Is there a case where this path isn't followed?
Thanks,
Yazen