ipc: fix memory leak in init_mqueue_fs()
authorZhengchao Shao <shaozhengchao@huawei.com>
Fri, 9 Dec 2022 09:29:29 +0000 (17:29 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 Dec 2022 03:30:20 +0000 (19:30 -0800)
commit12b677f2c697d61e5ddbcb6c1650050a39392f54
treef59f8f4216ce68ed11564ac2cdba8566e357cfcd
parent9f2b5debc07073e6dfdd774e3594d0224b991927
ipc: fix memory leak in init_mqueue_fs()

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>
ipc/mqueue.c