Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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>
  • Loading branch information
avikivity authored and Linus Torvalds committed Dec 30, 2006
1 parent c68876f commit 55a54f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/kvm/kvm_main.c
Expand Up @@ -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);
}

Expand Down

0 comments on commit 55a54f7

Please sign in to comment.