All of
 help / color / mirror / Atom feed
* [PATCH] edac: Fix reference count leak in edac_device_register_sysfs_main_kobj.
@ 2020-05-28 20:35 wu000273
  0 siblings, 0 replies; only message in thread
From: wu000273 @ 2020-05-28 20:35 UTC (permalink / raw)
  To: kjlu
  Cc: wu000273, Borislav Petkov, Mauro Carvalho Chehab, Tony Luck,
	James Morse, Robert Richter, Doug Thompson, Greg Kroah-Hartman,
	linux-edac, linux-kernel

From: Qiushi Wu <>

kobject_init_and_add() should be handled when it return an error,
because kobject_init_and_add() takes reference even when it fails.
If this function returns an error, kobject_put() must be called to
properly clean up the memory associated with the object. Previous
commit "b8eb718348b8" fixed a similar problem.

Fixes: b2ed215a3338 ("Kobject: change drivers/edac to use kobject_init_and_add")
Signed-off-by: Qiushi Wu <>
 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 0e7ea3591b78..5e7593753799 100644
--- a/drivers/edac/edac_device_sysfs.c
+++ b/drivers/edac/edac_device_sysfs.c
@@ -275,6 +275,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev)
 	/* Error exit stack */
+	kobject_put(&edac_dev->kobj);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-28 20:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28 20:35 [PATCH] edac: Fix reference count leak in edac_device_register_sysfs_main_kobj wu000273

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.