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.
Signed-off-by: Qiang Ma <maqianga@uniontech.com>
---
arch/loongarch/kvm/intc/ipi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/loongarch/kvm/intc/ipi.c b/arch/loongarch/kvm/intc/ipi.c
index 05cefd29282e..77169bf49f3f 100644
--- a/arch/loongarch/kvm/intc/ipi.c
+++ b/arch/loongarch/kvm/intc/ipi.c
@@ -459,6 +459,8 @@ 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);
+ /* alloc by kvm_ioctl_create_device, free by .destroy */
+ kfree(dev);
}
static struct kvm_device_ops kvm_ipi_dev_ops = {
--
2.20.1