ipc: simplify ipc initialization

Now that we know that rhashtable_init() will not fail, we can get rid of a
lot of the unnecessary cleanup paths when the call errored out.

[[email protected]: variable name added to util.h to resolve checkpatch warning]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Davidlohr Bueso <[email protected]>
Signed-off-by: Manfred Spraul <[email protected]>
Cc: Dmitry Vyukov <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Michael Kerrisk <[email protected]>
Cc: Michal Hocko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Davidlohr Bueso 2018-08-21 22:01:56 -07:00 • committed by Linus Torvalds
commit eae04d25a7
6 changed files with 30 additions and 54 deletions

View file

@ -55,28 +55,16 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
ns->user_ns = get_user_ns(user_ns);
ns->ucounts = ucounts;
err = sem_init_ns(ns);
if (err)
goto fail_put;
err = msg_init_ns(ns);
if (err)
goto fail_destroy_sem;
err = shm_init_ns(ns);
if (err)
goto fail_destroy_msg;
err = mq_init_ns(ns);
if (err)
goto fail_destroy_shm;
goto fail_put;
sem_init_ns(ns);
msg_init_ns(ns);
shm_init_ns(ns);
return ns;
fail_destroy_shm:
shm_exit_ns(ns);
fail_destroy_msg:
msg_exit_ns(ns);
fail_destroy_sem:
sem_exit_ns(ns);
fail_put:
put_user_ns(ns->user_ns);
ns_free_inum(&ns->ns);