All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nilfs2: fix memory leak in nilfs_sysfs_create_device_group
@ 2021-09-06  4:13 ` Dongliang Mu
  0 siblings, 0 replies; 16+ messages in thread
From: Dongliang Mu @ 2021-09-06  4:13 UTC (permalink / raw)
  To: Ryusuke Konishi; +Cc: paskripkin, Dongliang Mu, linux-nilfs, linux-kernel

The commit 8fd0c1b0647a ("nilfs2: fix memory leak in
nilfs_sysfs_delete_device_group") adds a kobject_put to free the leaking
object name. However, it is incomplete to only add kobject_put in the
nilfs_sysfs_delete_device_group. The function
nilfs_sysfs_create_device_group also needs the kobject_put to
free the object name in the error handling part.

Fix this by adding kobject_put in the error handling code of
nilfs_sysfs_create_device_group.

Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
---
 fs/nilfs2/sysfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/nilfs2/sysfs.c b/fs/nilfs2/sysfs.c
index 68e8d61e28dd..7ab60711ca76 100644
--- a/fs/nilfs2/sysfs.c
+++ b/fs/nilfs2/sysfs.c
@@ -1024,6 +1024,7 @@ int nilfs_sysfs_create_device_group(struct super_block *sb)
 
 cleanup_dev_kobject:
 	kobject_del(&nilfs->ns_dev_kobj);
+	kobject_put(&nilfs->ns_dev_kobj);
 
 free_dev_subgroups:
 	kfree(nilfs->ns_dev_subgroups);
-- 
2.25.1


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

end of thread, other threads:[~2021-09-13  5:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06  4:13 [PATCH] nilfs2: fix memory leak in nilfs_sysfs_create_device_group Dongliang Mu
2021-09-06  4:13 ` Dongliang Mu
2021-09-06  5:43 ` Dongliang Mu
2021-09-06  5:43   ` Dongliang Mu
2021-09-06 15:56   ` Pavel Skripkin
2021-09-06 15:56     ` Pavel Skripkin
2021-09-06 16:47     ` Pavel Skripkin
2021-09-06 16:47       ` Pavel Skripkin
2021-09-06 16:51       ` Pavel Skripkin
2021-09-06 16:51         ` Pavel Skripkin
2021-09-07  4:00       ` Dongliang Mu
2021-09-07  4:00         ` Dongliang Mu
2021-09-13  5:23         ` Dongliang Mu
2021-09-13  5:23           ` Dongliang Mu
2021-09-07  3:37     ` Dongliang Mu
2021-09-07  3:37       ` Dongliang Mu

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.