From: Kevin Wolf <kwolf@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, mreitz@redhat.com
Subject: Re: [PATCH 2/2] block: Fix Transaction leak in bdrv_reopen_multiple()
Date: Mon, 3 May 2021 16:33:04 +0200 [thread overview]
Message-ID: <YJAJoLY8P2u3+hrx@merkur.fritz.box> (raw)
In-Reply-To: <72a09cc7-383a-0818-7edc-dae75979a264@virtuozzo.com>
Am 03.05.2021 um 15:09 hat Vladimir Sementsov-Ogievskiy geschrieben:
> 03.05.2021 15:41, Kevin Wolf wrote:
> > Am 03.05.2021 um 13:40 hat Vladimir Sementsov-Ogievskiy geschrieben:
> > > 03.05.2021 14:05, Kevin Wolf wrote:
> > > > Like other error paths, this one needs to call tran_finalize() and clean
> > > > up the BlockReopenQueue, too.
> > >
> > > We don't need the "abort" loop on that path. And clean-up of
> > > BlockReopenQueue is at "cleanup:" label.
> >
> > The cleanup of the BlockReopenQueue itself is there, but not of all
> > fields in it. Specifically, these lines are needed:
> >
> > qobject_unref(bs_entry->state.explicit_options);
> > qobject_unref(bs_entry->state.options);
> >
> > The references are taken in bdrv_reopen_queue_child() and either used in
> > commit or released on abort. Doing nothing with them leaks them.
>
> Oops. Somehow I decided they are set in _prepare.
>
> >
> > > So I'd prefer Peter's suggestion (my "[PATCH 2/6] block:
> > > bdrv_reopen_multiple(): fix leak of tran object")
> >
> > I don't like it because I think every call that doesn't end in a commit,
> > should jump to the abort label to make sure that everything that remains
> > unused because of this is correctly cleaned up.
> >
>
>
> agree now..
>
> Still, don't we miss these two qobject_unref() calls on success path?
No, they are put to use in bdrv_reopen_commit():
qobject_unref(bs->explicit_options);
qobject_unref(bs->options);
bs->explicit_options = reopen_state->explicit_options;
bs->options = reopen_state->options;
Kevin
next prev parent reply other threads:[~2021-05-03 14:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-03 11:05 [PATCH 0/2] block: Fix Transaction leaks Kevin Wolf
2021-05-03 11:05 ` [PATCH 1/2] block: Fix Transaction leak in bdrv_root_attach_child() Kevin Wolf
2021-05-03 11:43 ` Vladimir Sementsov-Ogievskiy
2021-05-03 11:49 ` Max Reitz
2021-05-03 11:51 ` Vladimir Sementsov-Ogievskiy
2021-05-03 11:53 ` Max Reitz
2021-05-03 12:14 ` Vladimir Sementsov-Ogievskiy
2021-05-03 12:31 ` Vladimir Sementsov-Ogievskiy
2021-05-03 11:05 ` [PATCH 2/2] block: Fix Transaction leak in bdrv_reopen_multiple() Kevin Wolf
2021-05-03 11:40 ` Vladimir Sementsov-Ogievskiy
2021-05-03 12:41 ` Kevin Wolf
2021-05-03 13:09 ` Vladimir Sementsov-Ogievskiy
2021-05-03 14:33 ` Kevin Wolf [this message]
2021-05-04 6:52 ` Vladimir Sementsov-Ogievskiy
2021-05-04 6:51 ` Vladimir Sementsov-Ogievskiy
2021-05-04 6:56 ` [PATCH 0/2] block: Fix Transaction leaks Vladimir Sementsov-Ogievskiy
2021-05-05 10:25 ` Kevin Wolf
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=YJAJoLY8P2u3+hrx@merkur.fritz.box \
--to=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.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).