Skip to content

Commit 4aa675a

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull KVM fixes from Radim Krčmář: "All architectures avoid memory corruption in an error path. ARM prevents bogus acknowledgement of interrupts" * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: KVM: use after free in kvm_ioctl_create_device() KVM: arm/arm64: vgic: Don't notify EOI for non-SPIs
2 parents 3e52d06 + a0f1d21 commit 4aa675a

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

virt/kvm/arm/vgic/vgic-v2.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ void vgic_v2_process_maintenance(struct kvm_vcpu *vcpu)
5050

5151
WARN_ON(cpuif->vgic_lr[lr] & GICH_LR_STATE);
5252

53-
kvm_notify_acked_irq(vcpu->kvm, 0,
54-
intid - VGIC_NR_PRIVATE_IRQS);
53+
/* Only SPIs require notification */
54+
if (vgic_valid_spi(vcpu->kvm, intid))
55+
kvm_notify_acked_irq(vcpu->kvm, 0,
56+
intid - VGIC_NR_PRIVATE_IRQS);
5557
}
5658
}
5759

virt/kvm/arm/vgic/vgic-v3.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ void vgic_v3_process_maintenance(struct kvm_vcpu *vcpu)
4141

4242
WARN_ON(cpuif->vgic_lr[lr] & ICH_LR_STATE);
4343

44-
kvm_notify_acked_irq(vcpu->kvm, 0,
45-
intid - VGIC_NR_PRIVATE_IRQS);
44+
/* Only SPIs require notification */
45+
if (vgic_valid_spi(vcpu->kvm, intid))
46+
kvm_notify_acked_irq(vcpu->kvm, 0,
47+
intid - VGIC_NR_PRIVATE_IRQS);
4648
}
4749

4850
/*

virt/kvm/kvm_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2889,10 +2889,10 @@ static int kvm_ioctl_create_device(struct kvm *kvm,
28892889

28902890
ret = anon_inode_getfd(ops->name, &kvm_device_fops, dev, O_RDWR | O_CLOEXEC);
28912891
if (ret < 0) {
2892-
ops->destroy(dev);
28932892
mutex_lock(&kvm->lock);
28942893
list_del(&dev->vm_node);
28952894
mutex_unlock(&kvm->lock);
2895+
ops->destroy(dev);
28962896
return ret;
28972897
}
28982898

0 commit comments

Comments
 (0)