Commit b614c602 authored by KarimAllah Ahmed's avatar KarimAllah Ahmed Committed by Paolo Bonzini

KVM: Properly check if "page" is valid in kvm_vcpu_unmap

The field "page" is initialized to KVM_UNMAPPED_PAGE when it is not used
(i.e. when the memory lives outside kernel control). So this check will
always end up using kunmap even for memremap regions.

Fixes: e45adf66 ("KVM: Introduce a new guest mapping API")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarKarimAllah Ahmed <karahmed@amazon.de>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 548f7fb2
...@@ -1793,7 +1793,7 @@ void kvm_vcpu_unmap(struct kvm_vcpu *vcpu, struct kvm_host_map *map, ...@@ -1793,7 +1793,7 @@ void kvm_vcpu_unmap(struct kvm_vcpu *vcpu, struct kvm_host_map *map,
if (!map->hva) if (!map->hva)
return; return;
if (map->page) if (map->page != KVM_UNMAPPED_PAGE)
kunmap(map->page); kunmap(map->page);
#ifdef CONFIG_HAS_IOMEM #ifdef CONFIG_HAS_IOMEM
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment