qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] qemu-img: Fix options leakage in img_rebase()
Date: Mon, 3 Jun 2019 18:15:11 -0400	[thread overview]
Message-ID: <52cc7e39-5f86-9c55-9a6c-77df910569f6@redhat.com> (raw)
In-Reply-To: <20190528195338.12376-1-mreitz@redhat.com>



On 5/28/19 3:53 PM, Max Reitz wrote:
> img_rebase() can leak a QDict in two occasions.  Fix it.
> 
> Coverity: CID 1401416
> Fixes: d16699b64671466b42079c45b89127aeea1ca565
> Fixes: 330c72957196e0ae382abcaa97ebf4eb9bc8574f
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  qemu-img.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/qemu-img.c b/qemu-img.c
> index b0535919b1..86e1923acf 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -3347,6 +3347,7 @@ static int img_rebase(int argc, char **argv)
>                                                               out_baseimg,
>                                                               &local_err);
>              if (local_err) {
> +                qobject_unref(options);
>                  error_reportf_err(local_err,
>                                    "Could not resolve backing filename: ");
>                  ret = -1;
> @@ -3359,7 +3360,9 @@ static int img_rebase(int argc, char **argv)
>               */
>              prefix_chain_bs = bdrv_find_backing_image(bs, out_real_path);
>              if (prefix_chain_bs) {
> +                qobject_unref(options);
>                  g_free(out_real_path);
> +
>                  blk_new_backing = blk_new(BLK_PERM_CONSISTENT_READ,
>                                            BLK_PERM_ALL);
>                  ret = blk_insert_bs(blk_new_backing, prefix_chain_bs,
> 

I was going to ask about the other branch after this one, but:
"The reference to the QDict belongs to the block layer after the call
(even on failure)"

"Oh, well... OK."

Reviewed-by: John Snow <jsnow@redhat.com>


  parent reply	other threads:[~2019-06-03 22:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-28 19:53 [Qemu-devel] [PATCH] qemu-img: Fix options leakage in img_rebase() Max Reitz
2019-05-30  9:40 ` Kevin Wolf
2019-05-31 11:58   ` Max Reitz
2019-06-03 22:15 ` John Snow [this message]
2019-06-13 19:40 ` Max Reitz

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=52cc7e39-5f86-9c55-9a6c-77df910569f6@redhat.com \
    --to=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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).