Re: [PATCH] KVM: x86: Fix mce_banks memory leak on mci_ctl2_banks allocation failure

From: Sean Christopherson
Date: Thu Sep 08 2022 - 11:20:31 EST


On Tue, Aug 30, 2022, Sean Christopherson wrote:
> On Fri, Aug 19, 2022, Vipin Sharma wrote:
> > If mci_ctl2_banks allocation fails, kvm goes to fail_free_pio_data and
> > forgets about freeing mce_banks memory causing memory leak.
> >
> > Individually check memory allocation status and free memory in the correct
> > order.
> >
> > Fixes: 281b52780b57 ("KVM: x86: Add emulation for MSR_IA32_MCx_CTL2 MSRs.")
> > Signed-off-by: Vipin Sharma <vipinsh@xxxxxxxxxx>
> > ---
>
> Pushed to branch `for_paolo/6.1` at:
>
> https://github.com/sean-jc/linux.git
>
> Unless you hear otherwise, it will make its way to kvm/queue "soon".

Doh. Dropping this as Paolo already sent a different fix[*] to Linus, commit
3c0ba05ce9c9 ("KVM: x86: fix memoryleak in kvm_arch_vcpu_create()").

Sorry :-(

[*] https://lore.kernel.org/all/20220901122300.22298-1-linmiaohe@xxxxxxxxxx