Re: [PATCH 1/1] powerpc/kvm/book3s: Fixes possible 'use after release' of kvm

From: Leonardo Bras
Date: Thu Nov 28 2019 - 12:16:24 EST


On Wed, 2019-11-27 at 17:40 +0100, Paolo Bonzini wrote:
> > diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
> > index 5834db0a54c6..a402ead833b6 100644
> > --- a/arch/powerpc/kvm/book3s_64_vio.c
> > +++ b/arch/powerpc/kvm/book3s_64_vio.c
> > @@ -316,14 +316,13 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
> >
> > if (ret >= 0)
> > list_add_rcu(&stt->list, &kvm->arch.spapr_tce_tables);
> > - else
> > - kvm_put_kvm(kvm);
> >
> > mutex_unlock(&kvm->lock);
> >
> > if (ret >= 0)
> > return ret;
> >
> > + kvm_put_kvm(kvm);
> > kfree(stt);
> > fail_acct:
> > account_locked_vm(current->mm, kvmppc_stt_pages(npages), false);

Paul, do you think this change is still valid as it 'makes the code
clearer', as said by Paolo before? I would write a new commit message
to match the change.

Best regards,
Leonardo

Attachment: signature.asc
Description: This is a digitally signed message part