* [PATCH] KVM: Properly check if "page" is valid in kvm_vcpu_unmap
@ 2019-07-10 9:13 KarimAllah Ahmed
2019-07-10 14:25 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: KarimAllah Ahmed @ 2019-07-10 9:13 UTC (permalink / raw)
To: Paolo Bonzini, Radim Krčmář, kvm; +Cc: KarimAllah Ahmed
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>
---
virt/kvm/kvm_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 2f2d24a..e629766 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1790,7 +1790,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
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: Properly check if "page" is valid in kvm_vcpu_unmap
2019-07-10 9:13 [PATCH] KVM: Properly check if "page" is valid in kvm_vcpu_unmap KarimAllah Ahmed
@ 2019-07-10 14:25 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2019-07-10 14:25 UTC (permalink / raw)
To: KarimAllah Ahmed, Radim Krčmář, kvm
On 10/07/19 11:13, KarimAllah Ahmed wrote:
> 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>
> ---
> virt/kvm/kvm_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 2f2d24a..e629766 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1790,7 +1790,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
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-10 14:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-10 9:13 [PATCH] KVM: Properly check if "page" is valid in kvm_vcpu_unmap KarimAllah Ahmed
2019-07-10 14:25 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).