aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm_main.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2006-12-29 19:49:58 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-30 13:56:44 -0500
commit55a54f79e091d52c3c2835985c347ea4d2e1c21f (patch)
treead47898c216852e053806ee0fd6518380f23c9ab /drivers/kvm/kvm_main.c
parentc68876fd2846d2aaf9770276db244b46f2bf52c7 (diff)
[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>
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r--drivers/kvm/kvm_main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 0e618bcfe1da..973544553cba 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -245,7 +245,8 @@ static void kvm_free_physmem_slot(struct kvm_memory_slot *free,
245 if (!dont || free->phys_mem != dont->phys_mem) 245 if (!dont || free->phys_mem != dont->phys_mem)
246 if (free->phys_mem) { 246 if (free->phys_mem) {
247 for (i = 0; i < free->npages; ++i) 247 for (i = 0; i < free->npages; ++i)
248 __free_page(free->phys_mem[i]); 248 if (free->phys_mem[i])
249 __free_page(free->phys_mem[i]);
249 vfree(free->phys_mem); 250 vfree(free->phys_mem);
250 } 251 }
251 252