mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 22:21:42 +00:00
[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:
parent
c68876fd28
commit
55a54f79e0
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user