--- linux-2.4.22/kernel/fork.c Mon Aug 25 13:44:44 2003 +++ linux-2.4.26/kernel/fork.c Wed Apr 14 15:05:40 2004 @@ -114,8 +114,10 @@ last_pid = 300; next_safe = PID_MAX; } - if(unlikely(last_pid == beginpid)) + if(unlikely(last_pid == beginpid)) { + next_safe = 0; goto nomorepids; + } goto repeat; } if(p->pid > last_pid && next_safe > p->pid) @@ -266,6 +268,7 @@ { BUG_ON(mm == &init_mm); pgd_free(mm->pgd); + check_pgt_cache(); destroy_context(mm); free_mm(mm); } @@ -668,6 +671,7 @@ * than the amount of processes root is running. -- Rik */ if (atomic_read(&p->user->processes) >= p->rlim[RLIMIT_NPROC].rlim_cur + && p->user != &root_user && !capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE)) goto bad_fork_free; @@ -746,7 +750,8 @@ goto bad_fork_cleanup_fs; if (copy_mm(clone_flags, p)) goto bad_fork_cleanup_sighand; - if (copy_namespace(clone_flags, p)) + retval = copy_namespace(clone_flags, p); + if (retval) goto bad_fork_cleanup_mm; retval = copy_thread(0, clone_flags, stack_start, stack_size, p, regs); if (retval) @@ -821,6 +826,8 @@ exit_namespace(p); bad_fork_cleanup_mm: exit_mm(p); + if (p->active_mm) + mmdrop(p->active_mm); bad_fork_cleanup_sighand: exit_sighand(p); bad_fork_cleanup_fs: