KVM: Properly check if "page" is valid in kvm_vcpu_unmap
authorKarimAllah Ahmed <karahmed@amazon.de>
Wed, 10 Jul 2019 09:13:13 +0000 (11:13 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 10 Jul 2019 14:25:39 +0000 (16:25 +0200)
commitb614c6027896ff9ad6757122e84760d938cab15e
tree3a8901d55ac71cc4af0a2e671d48929f64db7df2
parent548f7fb22234c6fe13c64459059fbd42058953c4
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>
virt/kvm/kvm_main.c