mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-16 02:14:58 +00:00
ipc: fix memory leak in init_mqueue_fs()
[ Upstream commit 12b677f2c697d61e5ddbcb6c1650050a39392f54 ] When setup_mq_sysctls() failed in init_mqueue_fs(), mqueue_inode_cachep is not released. In order to fix this issue, the release path is reordered. Link: https://lkml.kernel.org/r/20221209092929.1978875-1-shaozhengchao@huawei.com Fixes: dc55e35f9e81 ("ipc: Store mqueue sysctls in the ipc namespace") Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com> Cc: Alexey Gladkov <legion@kernel.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Jingyu Wang <jingyuwang_vip@163.com> Cc: Muchun Song <songmuchun@bytedance.com> Cc: Roman Gushchin <roman.gushchin@linux.dev> Cc: Waiman Long <longman@redhat.com> Cc: Wei Yongjun <weiyongjun1@huawei.com> Cc: YueHaibing <yuehaibing@huawei.com> Cc: Yu Zhe <yuzhe@nfschina.com> Cc: Manfred Spraul <manfred@colorfullife.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
162433a960
commit
86273624a6
@ -1727,7 +1727,8 @@ static int __init init_mqueue_fs(void)
|
||||
|
||||
if (!setup_mq_sysctls(&init_ipc_ns)) {
|
||||
pr_warn("sysctl registration failed\n");
|
||||
return -ENOMEM;
|
||||
error = -ENOMEM;
|
||||
goto out_kmem;
|
||||
}
|
||||
|
||||
error = register_filesystem(&mqueue_fs_type);
|
||||
@ -1745,8 +1746,9 @@ static int __init init_mqueue_fs(void)
|
||||
out_filesystem:
|
||||
unregister_filesystem(&mqueue_fs_type);
|
||||
out_sysctl:
|
||||
kmem_cache_destroy(mqueue_inode_cachep);
|
||||
retire_mq_sysctls(&init_ipc_ns);
|
||||
out_kmem:
|
||||
kmem_cache_destroy(mqueue_inode_cachep);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user