* [Qemu-devel] [PATCH] block: Fix leak of BdrvIoctlCompletionData when driver returns NULL
@ 2016-05-31 8:34 Fam Zheng
2016-05-31 9:14 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Fam Zheng @ 2016-05-31 8:34 UTC (permalink / raw)
To: qemu-devel
Cc: Stefan Hajnoczi, Fam Zheng, Kevin Wolf, Max Reitz, qemu-block,
qemu-stable
"data" allocated in bdrv_co_do_ioctl is not freed. Free it before
returning.
Cc: qemu-stable@nongnu.org
Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
---
block/io.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/io.c b/block/io.c
index 2d832aa..aa5a5d7 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2320,6 +2320,7 @@ static void bdrv_ioctl_bh_cb(void *opaque)
bdrv_co_io_em_complete(data->co, -ENOTSUP);
qemu_bh_delete(data->bh);
+ g_free(data);
}
static int bdrv_co_do_ioctl(BlockDriverState *bs, int req, void *buf)
--
2.8.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] block: Fix leak of BdrvIoctlCompletionData when driver returns NULL
2016-05-31 8:34 [Qemu-devel] [PATCH] block: Fix leak of BdrvIoctlCompletionData when driver returns NULL Fam Zheng
@ 2016-05-31 9:14 ` Paolo Bonzini
2016-05-31 10:49 ` Fam Zheng
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2016-05-31 9:14 UTC (permalink / raw)
To: Fam Zheng, qemu-devel
Cc: Kevin Wolf, qemu-block, qemu-stable, Max Reitz, Stefan Hajnoczi
On 31/05/2016 10:34, Fam Zheng wrote:
> "data" allocated in bdrv_co_do_ioctl is not freed. Free it before
> returning.
>
> Cc: qemu-stable@nongnu.org
> Reported-by: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
> block/io.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/block/io.c b/block/io.c
> index 2d832aa..aa5a5d7 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -2320,6 +2320,7 @@ static void bdrv_ioctl_bh_cb(void *opaque)
>
> bdrv_co_io_em_complete(data->co, -ENOTSUP);
> qemu_bh_delete(data->bh);
> + g_free(data);
> }
>
> static int bdrv_co_do_ioctl(BlockDriverState *bs, int req, void *buf)
>
Is the bottom half needed at all? Why can't you just do "co.ret =
-ENOTSUP;"? The bottom half indirection is not needed for coroutine
functions, only for bdrv_aio_*; and bdrv_co_maybe_schedule_bh already
provides it.
Thanks,
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] block: Fix leak of BdrvIoctlCompletionData when driver returns NULL
2016-05-31 9:14 ` Paolo Bonzini
@ 2016-05-31 10:49 ` Fam Zheng
0 siblings, 0 replies; 3+ messages in thread
From: Fam Zheng @ 2016-05-31 10:49 UTC (permalink / raw)
To: Paolo Bonzini
Cc: qemu-devel, Kevin Wolf, qemu-block, qemu-stable, Max Reitz,
Stefan Hajnoczi
On Tue, 05/31 11:14, Paolo Bonzini wrote:
>
>
> On 31/05/2016 10:34, Fam Zheng wrote:
> > "data" allocated in bdrv_co_do_ioctl is not freed. Free it before
> > returning.
> >
> > Cc: qemu-stable@nongnu.org
> > Reported-by: Kevin Wolf <kwolf@redhat.com>
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> > block/io.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/block/io.c b/block/io.c
> > index 2d832aa..aa5a5d7 100644
> > --- a/block/io.c
> > +++ b/block/io.c
> > @@ -2320,6 +2320,7 @@ static void bdrv_ioctl_bh_cb(void *opaque)
> >
> > bdrv_co_io_em_complete(data->co, -ENOTSUP);
> > qemu_bh_delete(data->bh);
> > + g_free(data);
> > }
> >
> > static int bdrv_co_do_ioctl(BlockDriverState *bs, int req, void *buf)
> >
>
> Is the bottom half needed at all? Why can't you just do "co.ret =
> -ENOTSUP;"? The bottom half indirection is not needed for coroutine
> functions, only for bdrv_aio_*; and bdrv_co_maybe_schedule_bh already
> provides it.
>
You are right, I missed that. Let's drop the BH.
Fam
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-31 10:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-31 8:34 [Qemu-devel] [PATCH] block: Fix leak of BdrvIoctlCompletionData when driver returns NULL Fam Zheng
2016-05-31 9:14 ` Paolo Bonzini
2016-05-31 10:49 ` Fam Zheng
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.