Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55a54f79 authored by Avi Kivity's avatar Avi Kivity Committed by Linus Torvalds
Browse files

[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: default avatarAvi Kivity <avi@qumranet.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c68876fd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -245,6 +245,7 @@ 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)
				if (free->phys_mem[i])
					__free_page(free->phys_mem[i]);
			vfree(free->phys_mem);
		}