* [PATCH] Fix strange size check in __get_vm_area_node()
@ 2006-11-15 17:39 OGAWA Hirofumi
2006-11-15 17:51 ` Eric Dumazet
0 siblings, 1 reply; 2+ messages in thread
From: OGAWA Hirofumi @ 2006-11-15 17:39 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
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@mail.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@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix strange size check in __get_vm_area_node()
2006-11-15 17:39 [PATCH] Fix strange size check in __get_vm_area_node() OGAWA Hirofumi
@ 2006-11-15 17:51 ` Eric Dumazet
0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2006-11-15 17:51 UTC (permalink / raw)
To: OGAWA Hirofumi; +Cc: Andrew Morton, linux-kernel
On Wednesday 15 November 2006 18:39, OGAWA Hirofumi wrote:
> 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.
>
Indeed. I checked my original patch and it was correct. I dont know what
happened then...
http://lkml.org/lkml/2006/10/23/86
Eric
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-11-15 17:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-15 17:39 [PATCH] Fix strange size check in __get_vm_area_node() OGAWA Hirofumi
2006-11-15 17:51 ` Eric Dumazet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®