mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ipc: mqueue: fix possible memory leak in init_mqueue_fs()
@ 2022-07-15  6:23 Hangyu Hua
  2022-07-15 18:20 ` Eric W. Biederman
  2022-07-19 22:21 ` Eric W. Biederman
  0 siblings, 2 replies; 3+ messages in thread
From: Hangyu Hua @ 2022-07-15  6:23 UTC (permalink / raw)
  To: akpm, songmuchun, longman, roman.gushchin, ebiederm, legion
  Cc: linux-kernel, Hangyu Hua

commit db7cfc380900 ("ipc: Free mq_sysctls if ipc namespace creation
failed")

Here's a similar memory leak to the one fixed by the patch above.
retire_mq_sysctls need to be called when init_mqueue_fs fails after
setup_mq_sysctls.

Fixes: dc55e35f9e81 ("ipc: Store mqueue sysctls in the ipc namespace")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---
 ipc/mqueue.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 12ad7860bb88..83370fef8879 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -1746,6 +1746,7 @@ static int __init init_mqueue_fs(void)
 	unregister_filesystem(&mqueue_fs_type);
 out_sysctl:
 	kmem_cache_destroy(mqueue_inode_cachep);
+	retire_mq_sysctls(&init_ipc_ns);
 	return error;
 }
 
-- 
2.25.1


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-15  6:23 [PATCH] ipc: mqueue: fix possible memory leak in init_mqueue_fs() Hangyu Hua
2022-07-15 18:20 ` Eric W. Biederman
2022-07-19 22:21 ` Eric W. Biederman

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®