summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-01-08 14:09:57 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2024-01-08 14:09:57 +0100
commitfb872da8e720f8281dde01b8929419eb5ae6b033 (patch)
treeebd9be9500f7cfd550fcae98a321f66abdc3d944 /virt
parentMerge tag 'kvmarm-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmar... (diff)
parentKVM: Harden copying of userspace-array against overflow (diff)
downloadlinux-fb872da8e720f8281dde01b8929419eb5ae6b033.tar.xz
linux-fb872da8e720f8281dde01b8929419eb5ae6b033.zip
Merge tag 'kvm-x86-generic-6.8' of https://github.com/kvm-x86/linux into HEAD
Common KVM changes for 6.8: - Use memdup_array_user() to harden against overflow. - Unconditionally advertise KVM_CAP_DEVICE_CTRL for all architectures.
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 8d59f83458ca..10bfc88a69f7 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -4867,6 +4867,7 @@ static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
#endif
case KVM_CAP_BINARY_STATS_FD:
case KVM_CAP_SYSTEM_EVENT_DATA:
+ case KVM_CAP_DEVICE_CTRL:
return 1;
#ifdef CONFIG_KVM_GENERIC_MEMORY_ATTRIBUTES
case KVM_CAP_MEMORY_ATTRIBUTES:
@@ -5256,9 +5257,8 @@ static long kvm_vm_ioctl(struct file *filp,
goto out;
if (routing.nr) {
urouting = argp;
- entries = vmemdup_user(urouting->entries,
- array_size(sizeof(*entries),
- routing.nr));
+ entries = vmemdup_array_user(urouting->entries,
+ routing.nr, sizeof(*entries));
if (IS_ERR(entries)) {
r = PTR_ERR(entries);
goto out;