qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [PATCH 1/4] block/vvfat: Fix leak of BDRVVVFATState::qcow_filename
Date: Mon, 3 May 2021 15:14:33 +0200	[thread overview]
Message-ID: <20210503131433.totsjlkq6rdjl5m4@steredhat> (raw)
In-Reply-To: <20210430162519.271607-2-philmd@redhat.com>

On Fri, Apr 30, 2021 at 06:25:16PM +0200, Philippe Mathieu-Daudé wrote:
>qcow_filename is allocated in enable_write_target(), called by
>vvfat_open(), but never free'd. Free it in vvfat_close().
>
>This fixes (QEMU built with --enable-sanitizers):
>
>  Direct leak of 4096 byte(s) in 1 object(s) allocated from:
>      #0 0x55d7a363773f in malloc (/mnt/scratch/qemu/sanitizer/qemu-system-x86_64+0x1dab73f)
>      #1 0x7f55c6447958 in g_malloc (/lib64/libglib-2.0.so.0+0x58958)
>      #2 0x55d7a5e123aa in vvfat_open block/vvfat.c:1236:19
>      #3 0x55d7a5a5363f in bdrv_open_driver block.c:1526:15
>      #4 0x55d7a5a9d369 in bdrv_open_common block.c:1802:11
>      #5 0x55d7a5a609f1 in bdrv_open_inherit block.c:3444:11
>      #6 0x55d7a5a65411 in bdrv_open_child_bs block.c:3079:10
>      #7 0x55d7a5a60079 in bdrv_open_inherit block.c:3391:19
>      #8 0x55d7a5a65da3 in bdrv_open block.c:3537:12
>      #9 0x55d7a5b33f6a in blk_new_open block/block-backend.c:421:10
>      #10 0x55d7a5a0a33e in blockdev_init blockdev.c:610:15
>      #11 0x55d7a5a088e7 in drive_new blockdev.c:994:11
>      #12 0x55d7a51b10c4 in drive_init_func softmmu/vl.c:636:12
>      #13 0x55d7a620e148 in qemu_opts_foreach util/qemu-option.c:1167:14
>      #14 0x55d7a51b0e20 in configure_blockdev softmmu/vl.c:695:9
>      #15 0x55d7a51a70b5 in qemu_create_early_backends softmmu/vl.c:1895:5
>      #16 0x55d7a519bf87 in qemu_init softmmu/vl.c:3551:5
>      #17 0x55d7a366f619 in main softmmu/main.c:49:5
>
>Fixes: 8475ea48544 ("block/vvfat: Do not unref qcow on closing backing bdrv")
>Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>---
> block/vvfat.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/block/vvfat.c b/block/vvfat.c
>index 54807f82ca1..5a4a7915220 100644
>--- a/block/vvfat.c
>+++ b/block/vvfat.c
>@@ -3233,6 +3233,7 @@ static void vvfat_close(BlockDriverState *bs)
>     array_free(&(s->directory));
>     array_free(&(s->mapping));
>     g_free(s->cluster_buffer);
>+    g_free(s->qcow_filename);
>
>     if (s->qcow) {
>         migrate_del_blocker(s->migration_blocker);
>-- 
>2.26.3
>
>

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>



  reply	other threads:[~2021-05-03 13:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30 16:25 [PATCH 0/4] block/vvfat: Fix leaks and out of bounds writes Philippe Mathieu-Daudé
2021-04-30 16:25 ` [PATCH 1/4] block/vvfat: Fix leak of BDRVVVFATState::qcow_filename Philippe Mathieu-Daudé
2021-05-03 13:14   ` Stefano Garzarella [this message]
2021-04-30 16:25 ` [PATCH 2/4] block/vvfat: Fix leak of BDRVVVFATState::used_clusters Philippe Mathieu-Daudé
2021-05-03 13:24   ` Stefano Garzarella
2021-04-30 16:25 ` [PATCH 3/4] block/vvfat: Fix leak of mapping_t::path Philippe Mathieu-Daudé
2021-05-07 16:17   ` Max Reitz
2021-04-30 16:25 ` [PATCH 4/4] block/vvfat: Avoid out of bounds write in create_long_filename() Philippe Mathieu-Daudé
2021-05-05 13:46   ` Eric Blake
2021-05-05 13:11 ` [PATCH 0/4] block/vvfat: Fix leaks and out of bounds writes Johannes Schindelin

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=20210503131433.totsjlkq6rdjl5m4@steredhat \
    --to=sgarzare@redhat.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=philmd@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).