Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1793,7 +1793,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