Skip to content

Commit

Permalink
KVM: Fix kernel allocated memory slot
Browse files Browse the repository at this point in the history
Commit 7fd49de "KVM: ensure that memslot
userspace addresses are page-aligned" broke kernel space allocated memory
slot, for the userspace_addr is invalid.

Signed-off-by: Sheng Yang <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>
  • Loading branch information
Sheng Yang authored and avikivity committed Dec 31, 2008
1 parent 30ed5bb commit e7cacd4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
goto out;
if (mem->guest_phys_addr & (PAGE_SIZE - 1))
goto out;
if (mem->userspace_addr & (PAGE_SIZE - 1))
if (user_alloc && (mem->userspace_addr & (PAGE_SIZE - 1)))
goto out;
if (mem->slot >= KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS)
goto out;
Expand Down

0 comments on commit e7cacd4

Please sign in to comment.