Commit dca4a979604da1bac6956c0117abc2114d6dd3ec
Committed by
Linus Torvalds
1 parent
ed469a63c3
Exists in
master
and in
20 other branches
pidns: rewrite copy_pid_ns()
copy_pid_ns() is a perfect example of a case where unwinding leads to more code and makes it less clear. Watch the diffstat. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: Pavel Emelyanov <xemul@openvz.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Reviewed-by: Serge Hallyn <serue@us.ibm.com> Acked-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 3 additions and 15 deletions Side-by-side Diff
kernel/pid_namespace.c
... | ... | @@ -116,23 +116,11 @@ |
116 | 116 | |
117 | 117 | struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *old_ns) |
118 | 118 | { |
119 | - struct pid_namespace *new_ns; | |
120 | - | |
121 | - BUG_ON(!old_ns); | |
122 | - new_ns = get_pid_ns(old_ns); | |
123 | 119 | if (!(flags & CLONE_NEWPID)) |
124 | - goto out; | |
125 | - | |
126 | - new_ns = ERR_PTR(-EINVAL); | |
120 | + return get_pid_ns(old_ns); | |
127 | 121 | if (flags & CLONE_THREAD) |
128 | - goto out_put; | |
129 | - | |
130 | - new_ns = create_pid_namespace(old_ns); | |
131 | - | |
132 | -out_put: | |
133 | - put_pid_ns(old_ns); | |
134 | -out: | |
135 | - return new_ns; | |
122 | + return ERR_PTR(-EINVAL); | |
123 | + return create_pid_namespace(old_ns); | |
136 | 124 | } |
137 | 125 | |
138 | 126 | void free_pid_ns(struct kref *kref) |