summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-07-16 15:51:14 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2024-07-16 15:51:14 +0200
commitf4501e8bc88db2548b37afe100506358f1bf7504 (patch)
tree573b27707a299214923fb130335581c42f67eb59 /virt
parentMerge tag 'kvmarm-6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/kvma... (diff)
parentKVM: Validate hva in kvm_gpc_activate_hva() to fix __kvm_gpc_refresh() WARN (diff)
downloadlinux-f4501e8bc88db2548b37afe100506358f1bf7504.tar.xz
linux-f4501e8bc88db2548b37afe100506358f1bf7504.zip
Merge tag 'kvm-x86-fixes-6.10-11' of https://github.com/kvm-x86/linux into HEAD
KVM Xen: Fix a bug where KVM fails to check the validity of an incoming userspace virtual address and tries to activate a gfn_to_pfn_cache with a kernel address.
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/pfncache.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/virt/kvm/pfncache.c b/virt/kvm/pfncache.c
index e3453e869e92..f0039efb9e1e 100644
--- a/virt/kvm/pfncache.c
+++ b/virt/kvm/pfncache.c
@@ -430,6 +430,9 @@ int kvm_gpc_activate(struct gfn_to_pfn_cache *gpc, gpa_t gpa, unsigned long len)
int kvm_gpc_activate_hva(struct gfn_to_pfn_cache *gpc, unsigned long uhva, unsigned long len)
{
+ if (!access_ok((void __user *)uhva, len))
+ return -EINVAL;
+
return __kvm_gpc_activate(gpc, INVALID_GPA, uhva, len);
}