linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fengguang Wu <fengguang.wu@gmail.com>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [BUGFIX] NULL pointer dereference in __vm_enough_memory()
Date: Sun, 12 Aug 2007 13:29:15 +0800	[thread overview]
Message-ID: <386896556.06040@ustc.edu.cn> (raw)
Message-ID: <20070812052915.GA6769@mail.ustc.edu.cn> (raw)
In-Reply-To: <20070811141714.GA7232@cvg>

On Sat, Aug 11, 2007 at 06:17:14PM +0400, Cyrill Gorcunov wrote:
> [Fengguang Wu - Sat, Aug 11, 2007 at 09:21:31PM +0800]
> | Andrew,
> | 
> | I'm not sure if this patch is the right fix for the bug.  But it do
> | stops the oops message. The bug also happens in 2.6.23-rc1-mm2/2.6.23-rc2-mm2.
> | I'm running debian/sid. The .config is attached.
> | 
> |
> 
> [...snip...]
> 
> Even if you're right you have to make the same patch for
> mm/nommu.c but I've an anticipation the problem is growing
> up from another point (and I'm really hoping that I'm wrong ;)

Thank you, the patch is updated to:
===

Fix possible NULL pointer deference on __vm_enough_memory().

Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn>
---
 mm/mmap.c  |    3 ++-
 mm/nommu.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

--- linux-2.6.23-rc2-mm2.orig/mm/mmap.c
+++ linux-2.6.23-rc2-mm2/mm/mmap.c
@@ -166,7 +166,8 @@ int __vm_enough_memory(long pages, int c
 
 	/* Don't let a single process grow too big:
 	   leave 3% of the size of this process for other processes */
-	allowed -= current->mm->total_vm / 32;
+	if (current->mm)
+		allowed -= current->mm->total_vm / 32;
 
 	/*
 	 * cast `allowed' as a signed long because vm_committed_space
--- linux-2.6.23-rc2-mm2.orig/mm/nommu.c
+++ linux-2.6.23-rc2-mm2/mm/nommu.c
@@ -1342,7 +1342,8 @@ int __vm_enough_memory(long pages, int c
 
 	/* Don't let a single process grow too big:
 	   leave 3% of the size of this process for other processes */
-	allowed -= current->mm->total_vm / 32;
+	if (current->mm)
+		allowed -= current->mm->total_vm / 32;
 
 	/*
 	 * cast `allowed' as a signed long because vm_committed_space


  reply	other threads:[~2007-08-12  5:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070811132131.GA13775@mail.ustc.edu.cn>
2007-08-11 13:21 ` [BUGFIX] NULL pointer dereference in __vm_enough_memory() Fengguang Wu
2007-08-11 14:30   ` Balbir Singh
2007-08-11 17:00     ` Andrew Morton
2007-08-11 18:01       ` Balbir Singh
2007-08-11 18:13         ` Cyrill Gorcunov
     [not found]         ` <20070812054831.GB8992@mail.ustc.edu.cn>
2007-08-12  5:48           ` WU Fengguang
     [not found]           ` <20070812085808.GA7239@mail.ustc.edu.cn>
2007-08-12  8:58             ` WU Fengguang
2007-08-12  9:25               ` Balbir Singh
2007-08-12 12:23                 ` Cyrill Gorcunov
     [not found]       ` <20070812054606.GA8992@mail.ustc.edu.cn>
2007-08-12  5:46         ` WU Fengguang
2007-08-11 14:17 ` Cyrill Gorcunov
     [not found]   ` <20070812052915.GA6769@mail.ustc.edu.cn>
2007-08-12  5:29     ` Fengguang Wu [this message]
2007-08-12  5:45     ` Cyrill Gorcunov
     [not found] <46BEF5C0.3080902@linux.vnet.ibm.com>
     [not found] ` <20070812120902.GA9972@mail.ustc.edu.cn>
     [not found]   ` <20070812122746.GA10109@mail.ustc.edu.cn>
2007-08-12 12:27     ` WU Fengguang
2007-08-12 13:19       ` Alan Cox
     [not found]         ` <20070812140917.GA13683@mail.ustc.edu.cn>
2007-08-12 14:09           ` WU Fengguang
2007-08-12 15:17             ` Alan Cox
2007-08-12 16:21               ` Cyrill Gorcunov
     [not found]                 ` <20070813002342.GA6908@mail.ustc.edu.cn>
2007-08-13  0:23                   ` WU Fengguang
2007-08-13  9:53                   ` Cyrill Gorcunov
2007-08-13 11:22                     ` Alan Cox
2007-08-13 11:55                       ` Cyrill Gorcunov
2007-08-13  0:14               ` Rene Herman
     [not found]               ` <20070813073853.GA5262@mail.ustc.edu.cn>
2007-08-13  7:38                 ` WU Fengguang
2007-08-14 17:10     ` Andy Isaacson
     [not found]       ` <20070815085308.GA18959@mail.ustc.edu.cn>
2007-08-15  8:53         ` WU Fengguang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=386896556.06040@ustc.edu.cn \
    --to=fengguang.wu@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=gorcunov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).