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

Leonardo Bras leonardo at linux.ibm.com
Fri Nov 29 04:15:59 AEDT 2019


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20191128/bfe0734a/attachment.sig>


More information about the Linuxppc-dev mailing list