From: Peter Xu <peterx@redhat.com>
To: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: Fabiano Rosas <farosas@suse.de>,
qemu-devel@nongnu.org, Steve Sistare <steven.sistare@oracle.com>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH] migration: Free argv
Date: Mon, 26 Feb 2024 11:49:09 +0800 [thread overview]
Message-ID: <ZdwKNYI-uhkXJ4B5@x1n> (raw)
In-Reply-To: <20240225-argv-v1-1-a11e772884d9@daynix.com>
On Sun, Feb 25, 2024 at 02:54:01PM +0900, Akihiko Odaki wrote:
> exec_start_outgoing_migration() and exec_start_incoming_migration()
> leak argv because it uses g_steal_pointer() is used to pass argv
> qio_channel_command_new_spawn() while it does not free argv either.
>
> Removing g_steal_pointer() is not sufficient though because argv is
> typed g_auto(GStrv), which means the array of strings *and strings* will
> be freed. The strings are only borrowed from the caller of
> exec_start_outgoing_migration() and exec_start_incoming_migration() so
> freeing them result in double-free.
>
> Instead, type argv as g_autofree char **. This ensures only the array
> of strings will be freed and the strings won't be freed. Also, remove
> unnecessary casts according to the new type.
>
> Fixes: cbab4face57b ("migration: convert exec backend to accept MigrateAddress.")
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: qemu-stable <qemu-stable@nongnu.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
This should conflict with Steve's other series:
https://lore.kernel.org/r/1708638470-114846-1-git-send-email-steven.sistare@oracle.com
Considering this can be stable material, should be easier if we have the
other series rebased on top of this, even if that was sent first..
Steve, do you still plan to repost your series? Maybe you can review it &
pick this up into your series? Then whoever pick up your series will pick
up both (Markus will?)?
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2024-02-26 3:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-25 5:54 [PATCH] migration: Free argv Akihiko Odaki
2024-02-26 3:49 ` Peter Xu [this message]
2024-02-26 7:45 ` Akihiko Odaki
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=ZdwKNYI-uhkXJ4B5@x1n \
--to=peterx@redhat.com \
--cc=akihiko.odaki@daynix.com \
--cc=armbru@redhat.com \
--cc=farosas@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=steven.sistare@oracle.com \
/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).