diff options
author | KarimAllah Ahmed <karahmed@amazon.de> | 2019-07-10 05:13:13 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-07-10 10:25:39 -0400 |
commit | b614c6027896ff9ad6757122e84760d938cab15e (patch) | |
tree | 3a8901d55ac71cc4af0a2e671d48929f64db7df2 /virt | |
parent | 548f7fb22234c6fe13c64459059fbd42058953c4 (diff) |
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: e45adf665a53 ("KVM: Introduce a new guest mapping API")
Cc: stable@vger.kernel.org
Signed-off-by: KarimAllah Ahmed <karahmed@amazon.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 9613987ef4c8..49dd5cc73d95 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -1793,7 +1793,7 @@ void kvm_vcpu_unmap(struct kvm_vcpu *vcpu, struct kvm_host_map *map, | |||
1793 | if (!map->hva) | 1793 | if (!map->hva) |
1794 | return; | 1794 | return; |
1795 | 1795 | ||
1796 | if (map->page) | 1796 | if (map->page != KVM_UNMAPPED_PAGE) |
1797 | kunmap(map->page); | 1797 | kunmap(map->page); |
1798 | #ifdef CONFIG_HAS_IOMEM | 1798 | #ifdef CONFIG_HAS_IOMEM |
1799 | else | 1799 | else |