Message ID | 20240926151331.54544-2-massimiliano.pellizzer@canonical.com |
---|---|
State | New |
Headers | show |
Series | CVE-2024-36953 | expand |
diff --git a/virt/kvm/arm/vgic/vgic-kvm-device.c b/virt/kvm/arm/vgic/vgic-kvm-device.c index 5eaede3e3b5a..9497e8368b90 100644 --- a/virt/kvm/arm/vgic/vgic-kvm-device.c +++ b/virt/kvm/arm/vgic/vgic-kvm-device.c @@ -289,8 +289,10 @@ int vgic_v2_parse_attr(struct kvm_device *dev, struct kvm_device_attr *attr, if (cpuid >= atomic_read(&dev->kvm->online_vcpus)) return -EINVAL; - reg_attr->vcpu = kvm_get_vcpu(dev->kvm, cpuid); reg_attr->addr = attr->attr & KVM_DEV_ARM_VGIC_OFFSET_MASK; + reg_attr->vcpu = kvm_get_vcpu(dev->kvm, cpuid); + if (!reg_attr->vcpu) + return -EINVAL; return 0; }