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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e254412751
commit
ec81ed2fba
@@ -1754,7 +1754,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
|
||||||
|
|||||||
Reference in New Issue
Block a user