[PATCH 0/3] LoongArch: KVM: Fix kvm_device leak in kvm_{pch_pic|ipi|eiointc}_destroy

Qiang Ma posted 3 patches 1 month, 1 week ago
arch/loongarch/kvm/intc/eiointc.c | 2 ++
arch/loongarch/kvm/intc/ipi.c     | 2 ++
arch/loongarch/kvm/intc/pch_pic.c | 2 ++
3 files changed, 6 insertions(+)
[PATCH 0/3] LoongArch: KVM: Fix kvm_device leak in kvm_{pch_pic|ipi|eiointc}_destroy
Posted by Qiang Ma 1 month, 1 week ago
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_pch_pic_destroy() is not currently doing this,
that would lead to a memory leak.

So, fix it.

Qiang Ma (3):
  LoongArch: KVM: Fix kvm_device leak in kvm_pch_pic_destroy
  LoongArch: KVM: Fix kvm_device leak in kvm_ipi_destroy
  LoongArch: KVM: Fix kvm_device leak in kvm_eiointc_destroy

 arch/loongarch/kvm/intc/eiointc.c | 2 ++
 arch/loongarch/kvm/intc/ipi.c     | 2 ++
 arch/loongarch/kvm/intc/pch_pic.c | 2 ++
 3 files changed, 6 insertions(+)

-- 
2.20.1
Re: [PATCH 0/3] LoongArch: KVM: Fix kvm_device leak in kvm_{pch_pic|ipi|eiointc}_destroy
Posted by Bibo Mao 1 month, 1 week ago
Hi qiang,

Thanks for the patch, it looks good to me.

For the whole series.
Reviewed-by: Bibo Mao <maobibo@loongson.cn>

Regards
Bibo Mao

On 2025/12/26 下午11:07, Qiang Ma wrote:
> 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_pch_pic_destroy() is not currently doing this,
> that would lead to a memory leak.
> 
> So, fix it.
> 
> Qiang Ma (3):
>    LoongArch: KVM: Fix kvm_device leak in kvm_pch_pic_destroy
>    LoongArch: KVM: Fix kvm_device leak in kvm_ipi_destroy
>    LoongArch: KVM: Fix kvm_device leak in kvm_eiointc_destroy
> 
>   arch/loongarch/kvm/intc/eiointc.c | 2 ++
>   arch/loongarch/kvm/intc/ipi.c     | 2 ++
>   arch/loongarch/kvm/intc/pch_pic.c | 2 ++
>   3 files changed, 6 insertions(+)
>