summary refs log tree commit diff
path: root/ipc
diff options
context:
space:
mode:
authorHangyu Hua <hbh25y@gmail.com>2022-07-15 14:23:01 +0800
committerEric W. Biederman <ebiederm@xmission.com>2022-07-19 17:17:35 -0500
commitc579d60f0d0cd87552f64fdebe68b5d941d20309 (patch)
treee556f9560543d096fb001cfef6e34671707c9610 /ipc
parentf2906aa863381afb0015a9eb7fefad885d4e5a56 (diff)
downloadlinux-c579d60f0d0cd87552f64fdebe68b5d941d20309.tar.gz
ipc: mqueue: fix possible memory leak in init_mqueue_fs()
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>
Link: https://lkml.kernel.org/r/20220715062301.19311-1-hbh25y@gmail.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mqueue.c1
1 files changed, 1 insertions, 0 deletions
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 @@ out_filesystem:
 	unregister_filesystem(&mqueue_fs_type);
 out_sysctl:
 	kmem_cache_destroy(mqueue_inode_cachep);
+	retire_mq_sysctls(&init_ipc_ns);
 	return error;
 }