android_kernel_motorola_sm6375/virt/kvm
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Alexey Kardashevskiy 170465715a KVM: Don't null dereference ops->destroy
[ Upstream commit e8bc2427018826e02add7b0ed0fc625a60390ae5 ]

A KVM device cleanup happens in either of two callbacks:
1) destroy() which is called when the VM is being destroyed;
2) release() which is called when a device fd is closed.

Most KVM devices use 1) but Book3s's interrupt controller KVM devices
(XICS, XIVE, XIVE-native) use 2) as they need to close and reopen during
the machine execution. The error handling in kvm_ioctl_create_device()
assumes destroy() is always defined which leads to NULL dereference as
discovered by Syzkaller.

This adds a checks for destroy!=NULL and adds a missing release().

This is not changing kvm_destroy_devices() as devices with defined
release() should have been removed from the KVM devices list by then.

Suggested-by: Paolo Bonzini <[email protected]>
Signed-off-by: Alexey Kardashevskiy <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
2022-08-11 12:57:52 +02:00
..
arm KVM: arm64: Allow SMCCC_ARCH_WORKAROUND_3 to be discovered and migrated 2022-03-19 13:40:15 +01:00
async_pf.c KVM: x86: Use gpa_t for cr2/gpa to fix TDP support on 32-bit KVM 2020-02-11 04:35:53 -08:00
async_pf.h
coalesced_mmio.c KVM: mmio: Fix use-after-free Read in kvm_vm_ioctl_unregister_coalesced_mmio 2021-07-20 16:10:40 +02:00
coalesced_mmio.h
eventfd.c
irqchip.c
Kconfig
kvm_main.c KVM: Don't null dereference ops->destroy 2022-08-11 12:57:52 +02:00
vfio.c
vfio.h