Commit 0bf58cb7 authored by Qiang Ma's avatar Qiang Ma Committed by Huacai Chen
Browse files

LoongArch: KVM: Fix kvm_device leak in kvm_ipi_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_ipi_destroy() is not currently doing this, that
would lead to a memory leak.

So, fix it.

Cc: stable@vger.kernel.org
Reviewed-by: default avatarBibo Mao <maobibo@loongson.cn>
Signed-off-by: default avatarQiang Ma <maqianga@uniontech.com>
Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent 14ea5a36
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -459,6 +459,7 @@ static void kvm_ipi_destroy(struct kvm_device *dev)
	ipi = kvm->arch.ipi;
	kvm_io_bus_unregister_dev(kvm, KVM_IOCSR_BUS, &ipi->device);
	kfree(ipi);
	kfree(dev);
}

static struct kvm_device_ops kvm_ipi_dev_ops = {