aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-02-06 03:17:19 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-02-06 11:43:11 -0500
commit04ec93fe9bc98e3bd8560f79f56fed66dfae40d5 (patch)
treeba7d1ca513641167f61d8d8bb56b832f63d98bca /kernel/fork.c
parentb2a740aab8f3bc2fd9f01528e39607bd9a1f0da6 (diff)
fork.c: fix NULL pointer dereference when nr_threads == threads-max
I happened to forked lots of processes, and hit NULL pointer dereference. It is because in copy_process() after checking max_threads, 0 is returned but not -EAGAIN. The bug is introduced by "CRED: Detach the credentials from task_struct" (commit f1752eec6145c97163dbce62d17cf5d928e28a27). Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: James Morris <jmorris@namei.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 242a706e7721..6d5dbb7a13e2 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1005,6 +1005,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1005 * triggers too late. This doesn't hurt, the check is only there 1005 * triggers too late. This doesn't hurt, the check is only there
1006 * to stop root fork bombs. 1006 * to stop root fork bombs.
1007 */ 1007 */
1008 retval = -EAGAIN;
1008 if (nr_threads >= max_threads) 1009 if (nr_threads >= max_threads)
1009 goto bad_fork_cleanup_count; 1010 goto bad_fork_cleanup_count;
1010 1011