[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <87k61wa9to.fsf@duaron.myhome.or.jp>
Date: Thu, 16 Nov 2006 02:39:15 +0900
From: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To: Andrew Morton <akpm@...l.org>
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] Fix strange size check in __get_vm_area_node()
Recently, __get_vm_area_node() was changed like following
if (unlikely(!area))
return NULL;
- if (unlikely(!size)) {
- kfree (area);
+ if (unlikely(!size))
return NULL;
- }
It is leaking `area', also original code seems strange already.
Probably, we wanted to do this patch.
Signed-off-by: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
---
mm/vmalloc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff -puN mm/vmalloc.c~vmalloc-leak-fix mm/vmalloc.c
--- linux-2.6/mm/vmalloc.c~vmalloc-leak-fix 2006-11-16 00:41:49.000000000 +0900
+++ linux-2.6-hirofumi/mm/vmalloc.c 2006-11-16 00:41:49.000000000 +0900
@@ -181,14 +181,13 @@ static struct vm_struct *__get_vm_area_n
}
addr = ALIGN(start, align);
size = PAGE_ALIGN(size);
+ if (unlikely(!size))
+ return NULL;
area = kmalloc_node(sizeof(*area), gfp_mask & GFP_LEVEL_MASK, node);
if (unlikely(!area))
return NULL;
- if (unlikely(!size))
- return NULL;
-
/*
* We always allocate a guard page.
*/
_
--
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
-
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