mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] edac: fix kobject refcount leak in edac_device_create_instance
@ 2026-06-28 13:21 WenTao Liang
  2026-07-22 19:11 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: WenTao Liang @ 2026-06-28 13:21 UTC (permalink / raw)
  To: bp, tony.luck; +Cc: linux-edac, linux-kernel, WenTao Liang, Greg KH, stable

kobject_get(&edac_dev->kobj) acquires a reference on main_kobj, but it is
only released when kobject_init_and_add fails. The success path and the
block-creation error path both return without calling
kobject_put(main_kobj), leaking the edac_dev kobject reference. The
main_kobj pointer is local and lost after function return.

Suggested-by: Greg KH <gregkh@linuxfoundation.org>
Fixes: bee33f22d7c3 ("clocksource/drivers/nxp-pit: Add NXP Automotive s32g2 / s32g3 support")
Cc: stable@vger.kernel.org
Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
---
Changes in v2:
- Fix patch format based on reviewer feedback
---
 drivers/edac/edac_device_sysfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c
index b1c2717cd023..72b06d608b98 100644
--- a/drivers/edac/edac_device_sysfs.c
+++ b/drivers/edac/edac_device_sysfs.c
@@ -647,6 +647,7 @@ static int edac_device_create_instance(struct edac_device_ctl_info *edac_dev,
 
 	/* error unwind stack */
 err_release_instance_kobj:
+	kobject_put(main_kobj);
 	kobject_put(&instance->kobj);
 
 err_out:
-- 
2.39.5 (Apple Git-154)


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

* Re: [PATCH v2] edac: fix kobject refcount leak in edac_device_create_instance
  2026-06-28 13:21 [PATCH v2] edac: fix kobject refcount leak in edac_device_create_instance WenTao Liang
@ 2026-07-22 19:11 ` Borislav Petkov
  0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2026-07-22 19:11 UTC (permalink / raw)
  To: WenTao Liang; +Cc: tony.luck, linux-edac, linux-kernel, Greg KH, stable

On Sun, Jun 28, 2026 at 09:21:55PM +0800, WenTao Liang wrote:
> kobject_get(&edac_dev->kobj) acquires a reference on main_kobj, but it is
> only released when kobject_init_and_add fails. The success path and the
> block-creation error path both return without calling
> kobject_put(main_kobj), leaking the edac_dev kobject reference. The
> main_kobj pointer is local and lost after function return.
> 
> Suggested-by: Greg KH <gregkh@linuxfoundation.org>
> Fixes: bee33f22d7c3 ("clocksource/drivers/nxp-pit: Add NXP Automotive s32g2 / s32g3 support")

An EDAC patch fixes this?!?!

> Cc: stable@vger.kernel.org
> Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
> ---
> Changes in v2:
> - Fix patch format based on reviewer feedback
> ---
>  drivers/edac/edac_device_sysfs.c | 1 +
>  1 file changed, 1 insertion(+)

Also:

https://sashiko.dev/#/patchset/20260628132155.45969-1-vulab%40iscas.ac.cn

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

end of thread, other threads:[~2026-07-22 19:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-28 13:21 [PATCH v2] edac: fix kobject refcount leak in edac_device_create_instance WenTao Liang
2026-07-22 19:11 ` Borislav Petkov

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

all inboxes | Powered by JetHome®