Skip to content

Commit 7d8553f

Browse files
JohnsPonychenhuacai
authored andcommitted
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>
1 parent 0bf58cb commit 7d8553f

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

arch/loongarch/kvm/intc/eiointc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,7 @@ static void kvm_eiointc_destroy(struct kvm_device *dev)
679679
kvm_io_bus_unregister_dev(kvm, KVM_IOCSR_BUS, &eiointc->device);
680680
kvm_io_bus_unregister_dev(kvm, KVM_IOCSR_BUS, &eiointc->device_vext);
681681
kfree(eiointc);
682+
kfree(dev);
682683
}
683684

684685
static struct kvm_device_ops kvm_eiointc_dev_ops = {

0 commit comments

Comments
 (0)