summaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorKarimAllah Ahmed <karahmed@amazon.de>2019-07-10 11:13:13 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-29 16:31:19 +0200
commitec81ed2fba221b8bb92b8010e82d92e1de3b39fa (patch)
tree17ed07b75e2a9397afe8c6da772a00f19af3b15a /virt/kvm
parente25441275142a0d57a51025213c4b6ef17b193e6 (diff)
downloadlinux-stable-ec81ed2fba221b8bb92b8010e82d92e1de3b39fa.tar.gz
linux-stable-ec81ed2fba221b8bb92b8010e82d92e1de3b39fa.tar.bz2
linux-stable-ec81ed2fba221b8bb92b8010e82d92e1de3b39fa.zip
KVM: Properly check if "page" is valid in kvm_vcpu_unmap
commit b614c6027896ff9ad6757122e84760d938cab15e upstream. 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") Signed-off-by: KarimAllah Ahmed <karahmed@amazon.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/kvm_main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 5b949aa273de..33b288469c70 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1754,7 +1754,7 @@ void kvm_vcpu_unmap(struct kvm_vcpu *vcpu, struct kvm_host_map *map,
if (!map->hva)
return;
- if (map->page)
+ if (map->page != KVM_UNMAPPED_PAGE)
kunmap(map->page);
#ifdef CONFIG_HAS_IOMEM
else