Skip to content

Commit

Permalink
ipc: mqueue: fix possible memory leak in init_mqueue_fs()
Browse files Browse the repository at this point in the history
commit db7cfc3 ("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: dc55e35 ("ipc: Store mqueue sysctls in the ipc namespace")
Signed-off-by: Hangyu Hua <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Eric W. Biederman <[email protected]>
  • Loading branch information
HBh25Y authored and ebiederm committed Jul 19, 2022
1 parent f2906aa commit c579d60
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ipc/mqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit c579d60

Please sign in to comment.