summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQiang Ma <maqianga@uniontech.com>2026-01-17 10:57:02 +0800
committerHuacai Chen <chenhuacai@loongson.cn>2026-01-17 10:57:02 +0800
commit7d8553fc75aefa7ec936af0cf8443ff90b51732e (patch)
tree1a04cc9f576130070960da1d42ee58ee5da83941
parent0bf58cb7288a4d3de6d8ecbb3a65928a9362bf21 (diff)
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>
-rw-r--r--arch/loongarch/kvm/intc/eiointc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/loongarch/kvm/intc/eiointc.c b/arch/loongarch/kvm/intc/eiointc.c
index 29886876143f..dfaf6ccfdd8b 100644
--- a/arch/loongarch/kvm/intc/eiointc.c
+++ b/arch/loongarch/kvm/intc/eiointc.c
@@ -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 = {