ipc: mqueue: fix possible memory leak in init_mqueue_fs()

[ Upstream commit c579d60f0d ]

commit db7cfc3809 ("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: dc55e35f9e ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Hangyu Hua 2022-07-15 14:23:01 +08:00 committed by Greg Kroah-Hartman
parent 908bfb4f5f
commit a1f321051e
1 changed files with 1 additions and 0 deletions

View File

@ -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;
}