Commit c579d60f authored by Hangyu Hua's avatar Hangyu Hua Committed by Eric W. Biederman

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

commit db7cfc38 ("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: dc55e35f ("ipc: Store mqueue sysctls in the ipc namespace")
Signed-off-by: default avatarHangyu Hua <hbh25y@gmail.com>
Link: https://lkml.kernel.org/r/20220715062301.19311-1-hbh25y@gmail.comSigned-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
parent f2906aa8
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment