diff options
| author | Davidlohr Bueso <dave@stgolabs.net> | 2018-08-22 01:01:56 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-22 13:52:52 -0400 |
| commit | eae04d25a713304c978d7c45dcab01b0e0811c74 (patch) | |
| tree | 7b2dfd99330a00a7586a8b8368161df9457bcd96 /ipc/namespace.c | |
| parent | dc2c8c84def6ce450c63529e08c1db100020994e (diff) | |
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.
[manfred@colorfullife.com: variable name added to util.h to resolve checkpatch warning]
Link: http://lkml.kernel.org/r/20180712185241.4017-11-manfred@colorfullife.com
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Kees Cook <keescook@chromium.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/namespace.c')
| -rw-r--r-- | ipc/namespace.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/ipc/namespace.c b/ipc/namespace.c index f59a89966f92..21607791d62c 100644 --- a/ipc/namespace.c +++ b/ipc/namespace.c | |||
| @@ -55,28 +55,16 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns, | |||
| 55 | ns->user_ns = get_user_ns(user_ns); | 55 | ns->user_ns = get_user_ns(user_ns); |
| 56 | ns->ucounts = ucounts; | 56 | ns->ucounts = ucounts; |
| 57 | 57 | ||
| 58 | err = sem_init_ns(ns); | 58 | err = mq_init_ns(ns); |
| 59 | if (err) | 59 | if (err) |
| 60 | goto fail_put; | 60 | goto fail_put; |
| 61 | err = msg_init_ns(ns); | ||
| 62 | if (err) | ||
| 63 | goto fail_destroy_sem; | ||
| 64 | err = shm_init_ns(ns); | ||
| 65 | if (err) | ||
| 66 | goto fail_destroy_msg; | ||
| 67 | 61 | ||
| 68 | err = mq_init_ns(ns); | 62 | sem_init_ns(ns); |
| 69 | if (err) | 63 | msg_init_ns(ns); |
| 70 | goto fail_destroy_shm; | 64 | shm_init_ns(ns); |
| 71 | 65 | ||
| 72 | return ns; | 66 | return ns; |
| 73 | 67 | ||
| 74 | fail_destroy_shm: | ||
| 75 | shm_exit_ns(ns); | ||
| 76 | fail_destroy_msg: | ||
| 77 | msg_exit_ns(ns); | ||
| 78 | fail_destroy_sem: | ||
| 79 | sem_exit_ns(ns); | ||
| 80 | fail_put: | 68 | fail_put: |
| 81 | put_user_ns(ns->user_ns); | 69 | put_user_ns(ns->user_ns); |
| 82 | ns_free_inum(&ns->ns); | 70 | ns_free_inum(&ns->ns); |
