All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-3.0] qcow: fix a reference leak
@ 2018-07-25 18:07 KONRAD Frederic
  2018-07-26  9:33 ` Kevin Wolf
  0 siblings, 1 reply; 2+ messages in thread
From: KONRAD Frederic @ 2018-07-25 18:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, kwolf, mreitz, qemu-block, qemu-stable, KONRAD Frederic

Since 42a3e1ab367cdf38cce093de24eb406b99a4ef96 qemu asserts when using the
vvfat driver:

git clone git://qemu.org/qemu.git
cd qemu
./configure --target-list=ppc-softmmu --enable-debug
make -j8
mkdir foo
touch foo/hello
./ppc-softmmu/qemu-system-ppc -M prep --nographic --monitor null             \
                              -hda fat:rw:./foo

"Ctrl-C"

qemu-system-ppc: block.c:3368: bdrv_close_all: Assertion                     \
   `((&all_bdrv_states)->tqh_first == ((void *)0))' failed.

This is because we reference bs twice in qcow_co_create(..) one time in
bdrv_open_blockdev_ref(..) and in blk_insert_bs(..) but we unref it only once
in blk_unref which leads to the reference leak.

Note that I didn't tested much QCOW after this change as I don't use it much.

Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
---
 block/qcow.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/qcow.c b/block/qcow.c
index 102d058..385d935 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -938,6 +938,7 @@ static int coroutine_fn qcow_co_create(BlockdevCreateOptions *opts,
     ret = 0;
 exit:
     blk_unref(qcow_blk);
+    bdrv_unref(bs);
     qcrypto_block_free(crypto);
     return ret;
 }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH for-3.0] qcow: fix a reference leak
  2018-07-25 18:07 [Qemu-devel] [PATCH for-3.0] qcow: fix a reference leak KONRAD Frederic
@ 2018-07-26  9:33 ` Kevin Wolf
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2018-07-26  9:33 UTC (permalink / raw)
  To: KONRAD Frederic
  Cc: qemu-devel, peter.maydell, mreitz, qemu-block, qemu-stable

Am 25.07.2018 um 20:07 hat KONRAD Frederic geschrieben:
> Since 42a3e1ab367cdf38cce093de24eb406b99a4ef96 qemu asserts when using the
> vvfat driver:
> 
> git clone git://qemu.org/qemu.git
> cd qemu
> ./configure --target-list=ppc-softmmu --enable-debug
> make -j8
> mkdir foo
> touch foo/hello
> ./ppc-softmmu/qemu-system-ppc -M prep --nographic --monitor null             \
>                               -hda fat:rw:./foo
> 
> "Ctrl-C"
> 
> qemu-system-ppc: block.c:3368: bdrv_close_all: Assertion                     \
>    `((&all_bdrv_states)->tqh_first == ((void *)0))' failed.
> 
> This is because we reference bs twice in qcow_co_create(..) one time in
> bdrv_open_blockdev_ref(..) and in blk_insert_bs(..) but we unref it only once
> in blk_unref which leads to the reference leak.
> 
> Note that I didn't tested much QCOW after this change as I don't use it much.
> 
> Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>

Thanks, applied to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-26  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25 18:07 [Qemu-devel] [PATCH for-3.0] qcow: fix a reference leak KONRAD Frederic
2018-07-26  9:33 ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.