mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-02 02:19:54 -04:00
LoongArch: KVM: Fix kvm_device leak in kvm_eiointc_destroy()
In kvm_ioctl_create_device(), kvm_device has allocated memory, kvm_device->destroy() seems to be supposed to free its kvm_device struct, but kvm_eiointc_destroy() is not currently doing this, that would lead to a memory leak. So, fix it. Cc: stable@vger.kernel.org Reviewed-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Qiang Ma <maqianga@uniontech.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
@@ -679,6 +679,7 @@ static void kvm_eiointc_destroy(struct kvm_device *dev)
|
||||
kvm_io_bus_unregister_dev(kvm, KVM_IOCSR_BUS, &eiointc->device);
|
||||
kvm_io_bus_unregister_dev(kvm, KVM_IOCSR_BUS, &eiointc->device_vext);
|
||||
kfree(eiointc);
|
||||
kfree(dev);
|
||||
}
|
||||
|
||||
static struct kvm_device_ops kvm_eiointc_dev_ops = {
|
||||
|
||||
Reference in New Issue
Block a user