dect
/
linux-2.6
Archived
13
0
Fork 0

[PATCH] KVM: Fix oops on oom

__free_page() doesn't like a NULL argument, so check before calling it.  A
NULL can only happen if memory is exhausted during allocation of a memory
slot.

Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Avi Kivity 2006-12-29 16:49:58 -08:00 committed by Linus Torvalds
parent c68876fd28
commit 55a54f79e0
1 changed files with 2 additions and 1 deletions

View File

@ -245,7 +245,8 @@ static void kvm_free_physmem_slot(struct kvm_memory_slot *free,
if (!dont || free->phys_mem != dont->phys_mem)
if (free->phys_mem) {
for (i = 0; i < free->npages; ++i)
__free_page(free->phys_mem[i]);
if (free->phys_mem[i])
__free_page(free->phys_mem[i]);
vfree(free->phys_mem);
}