lkml.org 
[lkml]   [2009]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] vmalloc.c: fix lose num_physpages checking
From
Date
__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);



\
 
 \ /
  Last update: 2009-07-10 04:09    [W:0.054 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site