All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Figo.zhang" <figo1802@gmail.com>
To: Andrew Morton <akpm@osdl.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: lkml <linux-kernel@vger.kernel.org>, Tejun Heo <tj@kernel.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: [PATCH] vmalloc.c: fix lose num_physpages checking
Date: Fri, 10 Jul 2009 10:06:44 +0800	[thread overview]
Message-ID: <1247191604.2572.3.camel@myhost> (raw)

__get_vm_area_node() lose size (physpages limit) checking, it be called by
__get_vm_area() that some drivers called it directly.

Signed-off-by: Figo.zhang  <figo1802@gmail.com>
--- 
mm/vmalloc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index f8189a4..99f3aea 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1144,7 +1144,7 @@ static struct vm_struct *__get_vm_area_node(unsigned long size,
 	}
 
 	size = PAGE_ALIGN(size);
-	if (unlikely(!size))
+	if (unlikely(!size || (size >> PAGE_SHIFT) > num_physpages))
 		return NULL;
 
 	area = kmalloc_node(sizeof(*area), gfp_mask & GFP_RECLAIM_MASK, node);



             reply	other threads:[~2009-07-10  2:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-10  2:06 Figo.zhang [this message]
2009-07-22 20:16 ` [PATCH] vmalloc.c: fix lose num_physpages checking Andrew Morton

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=1247191604.2572.3.camel@myhost \
    --to=figo1802@gmail.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.