[<prev] [next>] [day] [month] [year] [list]
Message-ID: <498B8EEB.7050104@cn.fujitsu.com>
Date: Fri, 06 Feb 2009 09:14:19 +0800
From: Li Zefan <lizf@...fujitsu.com>
To: Andrew Morton <akpm@...ux-foundation.org>
CC: David Howells <dhowells@...hat.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] 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 this patch:
| commit f1752eec6145c97163dbce62d17cf5d928e28a27
| Author: David Howells <dhowells@...hat.com>
| Date: Fri Nov 14 10:39:17 2008 +1100
|
| CRED: Detach the credentials from task_struct
Signed-off-by: Li Zefan <lizf@...fujitsu.com>
---
kernel/fork.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/kernel/fork.c b/kernel/fork.c
index 242a706..6d5dbb7 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1005,6 +1005,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
* triggers too late. This doesn't hurt, the check is only there
* to stop root fork bombs.
*/
+ retval = -EAGAIN;
if (nr_threads >= max_threads)
goto bad_fork_cleanup_count;
--
1.5.4.rc3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists