* [PATCH] fork.c: fix NULL pointer dereference when nr_threads == threads-max
@ 2009-02-06 8:17 David Howells
2009-02-06 13:06 ` James Morris
0 siblings, 1 reply; 3+ messages in thread
From: David Howells @ 2009-02-06 8:17 UTC (permalink / raw)
To: torvalds, akpm, jmorris; +Cc: linux-kernel, linux-security-module
From: Li Zefan <lizf@cn.fujitsu.com>
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@redhat.com>
| Date: Fri Nov 14 10:39:17 2008 +1100
|
| CRED: Detach the credentials from task_struct
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: David Howells <dhowells@redhat.com>
---
kernel/fork.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/kernel/fork.c b/kernel/fork.c
index bf0cef8..586874d 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1007,6 +1007,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;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fork.c: fix NULL pointer dereference when nr_threads == threads-max
2009-02-06 8:17 [PATCH] fork.c: fix NULL pointer dereference when nr_threads == threads-max David Howells
@ 2009-02-06 13:06 ` James Morris
0 siblings, 0 replies; 3+ messages in thread
From: James Morris @ 2009-02-06 13:06 UTC (permalink / raw)
To: David Howells; +Cc: torvalds, akpm, linux-kernel, linux-security-module
On Fri, 6 Feb 2009, David Howells wrote:
> From: Li Zefan <lizf@cn.fujitsu.com>
>
> 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@redhat.com>
> | Date: Fri Nov 14 10:39:17 2008 +1100
> |
> | CRED: Detach the credentials from task_struct
>
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: James Morris <jmorris@namei.org>
> ---
>
> kernel/fork.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
>
> diff --git a/kernel/fork.c b/kernel/fork.c
> index bf0cef8..586874d 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -1007,6 +1007,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;
>
>
--
James Morris
<jmorris@namei.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] fork.c: fix NULL pointer dereference when nr_threads == threads-max
@ 2009-02-06 1:14 Li Zefan
0 siblings, 0 replies; 3+ messages in thread
From: Li Zefan @ 2009-02-06 1:14 UTC (permalink / raw)
To: Andrew Morton; +Cc: David Howells, LKML
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@redhat.com>
| Date: Fri Nov 14 10:39:17 2008 +1100
|
| CRED: Detach the credentials from task_struct
Signed-off-by: Li Zefan <lizf@cn.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-02-06 13:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-06 8:17 [PATCH] fork.c: fix NULL pointer dereference when nr_threads == threads-max David Howells
2009-02-06 13:06 ` James Morris
-- strict thread matches above, loose matches on Subject: below --
2009-02-06 1:14 Li Zefan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).