Commit e496a2dc authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

[PATCH] vmalloc corner case.

get_vm_area() doesn't play too well when passed
malformed arguments due to a missing check.
Originally by davem, munged by me.
parent 0071b038
...@@ -203,6 +203,10 @@ struct vm_struct *get_vm_area(unsigned long size, unsigned long flags) ...@@ -203,6 +203,10 @@ struct vm_struct *get_vm_area(unsigned long size, unsigned long flags)
* We always allocate a guard page. * We always allocate a guard page.
*/ */
size += PAGE_SIZE; size += PAGE_SIZE;
if (unlikely(!size)) {
kfree (area);
return NULL;
}
write_lock(&vmlist_lock); write_lock(&vmlist_lock);
for (p = &vmlist; (tmp = *p) ;p = &tmp->next) { for (p = &vmlist; (tmp = *p) ;p = &tmp->next) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment