[PATCH] handling of failed copy_thread() in do_fork()

Alexander Viro (viro@math.psu.edu)
Wed, 25 Apr 2001 22:23:15 -0400 (EDT)


If copy_thread() fails (it can't happen on x86, but on other
architectures, e.g. on sparc, it's possible) do_fork() doesn't do
full cleanup - it forgets to do exit_mm(). Obvious fix follows.
Please, apply.
Al

diff -urN S4-pre7/kernel/fork.c S4-pre7-fork/kernel/fork.c
--- S4-pre7/kernel/fork.c Wed Apr 25 20:43:12 2001
+++ S4-pre7-fork/kernel/fork.c Wed Apr 25 22:12:39 2001
@@ -652,7 +652,7 @@
goto bad_fork_cleanup_sighand;
retval = copy_thread(0, clone_flags, stack_start, stack_size, p, regs);
if (retval)
- goto bad_fork_cleanup_sighand;
+ goto bad_fork_cleanup_mm;
p->semundo = NULL;

/* Our parent execution domain becomes current domain
@@ -708,6 +708,8 @@
down(&sem);
return retval;

+bad_fork_cleanup_mm:
+ exit_mm(p);
bad_fork_cleanup_sighand:
exit_sighand(p);
bad_fork_cleanup_fs:

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/