qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bin Guo <guobin@linux.alibaba.com>
To: armbru@redhat.com
Cc: farosas@suse.de, peterx@redhat.com, qemu-devel@nongnu.org,
	berrange@redhat.com
Subject: Re: [PATCH] migration: Don't free the reason after calling migrate_add_blocker
Date: Fri, 24 Oct 2025 19:53:05 +0800	[thread overview]
Message-ID: <20251024115305.1424-1-guobin@linux.alibaba.com> (raw)
In-Reply-To: <87o6pw1rfn.fsf@pond.sub.org>

Markus Armbruster <armbru@redhat.com> writes:

> > Signed-off-by: Bin Guo <guobin@linux.alibaba.com>
> > ---
> >  hw/intc/arm_gicv3_kvm.c | 1 -
> >  target/i386/sev.c       | 1 -
> >  2 files changed, 2 deletions(-)
> >
> > diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
> > index 66b0dddfd4..6f311e37ef 100644
> > --- a/hw/intc/arm_gicv3_kvm.c
> > +++ b/hw/intc/arm_gicv3_kvm.c
> > @@ -841,7 +841,6 @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp)
> >          error_setg(&kvm_nv_migration_blocker,
> >                     "Live migration disabled because KVM nested virt is enabled");
> >          if (migrate_add_blocker(&kvm_nv_migration_blocker, errp)) {
> > -            error_free(kvm_nv_migration_blocker);
> >              return;
> >          }
> >  
> > diff --git a/target/i386/sev.c b/target/i386/sev.c
> > index 1057b8ab2c..fd2dada013 100644
> > --- a/target/i386/sev.c
> > +++ b/target/i386/sev.c
> > @@ -1661,7 +1661,6 @@ sev_snp_launch_finish(SevCommonState *sev_common)
> >      ret = migrate_add_blocker(&sev_mig_blocker, &local_err);
> >      if (local_err) {
> >          error_report_err(local_err);
> > -        error_free(sev_mig_blocker);
> >          exit(1);
> >      }
> >  }
> 
> Does this fix use-after-free bugs?

No, just delete the unnecessary code and follow the best practice.
Function migrate_add_blocker will free the reason and set it to NULL
if failure is returned.



  parent reply	other threads:[~2025-10-24 11:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24  9:28 [PATCH] migration: Don't free the reason after calling migrate_add_blocker Bin Guo
2025-10-24 11:15 ` Markus Armbruster
2025-10-24 11:27   ` Daniel P. Berrangé
2025-10-24 13:41     ` Markus Armbruster
2025-10-24 14:08       ` Markus Armbruster
2025-10-24 16:17         ` Peter Xu
2025-10-24 16:31           ` Daniel P. Berrangé
2025-10-24 18:15             ` Fabiano Rosas
2025-10-27 10:25               ` Daniel P. Berrangé
2025-10-27 12:32                 ` Markus Armbruster
2025-10-27 13:54                   ` Fabiano Rosas
2025-10-24 11:53   ` Bin Guo [this message]
2025-10-24 13:40     ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251024115305.1424-1-guobin@linux.alibaba.com \
    --to=guobin@linux.alibaba.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=farosas@suse.de \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).