Commit 314a8ad0f18ac37887896b288939acd8cb17e208
Committed by
Linus Torvalds
1 parent
4271b05a22
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
pidns: fix free_pid() to handle the first fork failure
"case 0" in free_pid() assumes that disable_pid_allocation() should clear PIDNS_HASH_ADDING before the last pid goes away. However this doesn't happen if the first fork() fails to create the child reaper which should call disable_pid_allocation(). Signed-off-by: Oleg Nesterov <oleg@redhat.com> Reviewed-by: "Eric W. Biederman" <ebiederm@xmission.com> Cc: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 5 additions and 0 deletions Side-by-side Diff
kernel/pid.c
... | ... | @@ -273,6 +273,11 @@ |
273 | 273 | */ |
274 | 274 | wake_up_process(ns->child_reaper); |
275 | 275 | break; |
276 | + case PIDNS_HASH_ADDING: | |
277 | + /* Handle a fork failure of the first process */ | |
278 | + WARN_ON(ns->child_reaper); | |
279 | + ns->nr_hashed = 0; | |
280 | + /* fall through */ | |
276 | 281 | case 0: |
277 | 282 | schedule_work(&ns->proc_work); |
278 | 283 | break; |