Linux EDAC development
 help / color / mirror / Atom feed
From: WenTao Liang <vulab@iscas.ac.cn>
To: bp@alien8.de, tony.luck@intel.com
Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
	WenTao Liang <vulab@iscas.ac.cn>,
	stable@vger.kernel.org
Subject: [PATCH] fix: edac: edac_device_create_instance: main_kobj reference leaked on   success and block-creation error paths
Date: Fri, 26 Jun 2026 20:35:23 +0800	[thread overview]
Message-ID: <20260626123523.36166-1-vulab@iscas.ac.cn> (raw)

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.

Cc: stable@vger.kernel.org
Fixes: c10997f6575f ("Kobject: convert drivers/* from kobject_unregister() to kobject_put()")
Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
---
 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)


             reply	other threads:[~2026-06-26 12:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26 12:35 WenTao Liang [this message]
2026-06-28  3:53 ` [PATCH] fix: edac: edac_device_create_instance: main_kobj reference leaked on success and block-creation error paths WenTao Liang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260626123523.36166-1-vulab@iscas.ac.cn \
    --to=vulab@iscas.ac.cn \
    --cc=bp@alien8.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox