qemu-stable
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-stable] [PATCH] block: Fix leak of BdrvIoctlCompletionData whe


From: Paolo Bonzini
Subject: Re: [Qemu-stable] [PATCH] block: Fix leak of BdrvIoctlCompletionData when driver returns NULL
Date: Tue, 31 May 2016 11:14:05 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0


On 31/05/2016 10:34, Fam Zheng wrote:
> "data" allocated in bdrv_co_do_ioctl is not freed. Free it before
> returning.
> 
> Cc: address@hidden
> Reported-by: Kevin Wolf <address@hidden>
> Signed-off-by: Fam Zheng <address@hidden>
> ---
>  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]