[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-block] [PATCH v2 1/4] block: Fix anonymous BBs in
From: |
Jeff Cody |
Subject: |
Re: [Qemu-devel] [Qemu-block] [PATCH v2 1/4] block: Fix anonymous BBs in blk_root_inactivate() |
Date: |
Tue, 30 May 2017 11:28:43 -0400 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Tue, May 30, 2017 at 05:22:50PM +0200, Kevin Wolf wrote:
> blk->name isn't an array, but a pointer that can be NULL. Checking for
> an anonymous BB must involve a NULL check first, otherwise we get
> crashes.
>
> Signed-off-by: Kevin Wolf <address@hidden>
> Reviewed-by: Fam Zheng <address@hidden>
> Reviewed-by: Juan Quintela <address@hidden>
> Reviewed-by: Eric Blake <address@hidden>
> ---
> block/block-backend.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/block-backend.c b/block/block-backend.c
> index f3a6008..7d7f369 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -168,7 +168,7 @@ static int blk_root_inactivate(BdrvChild *child)
> * this point because the VM is stopped) and unattached monitor-owned
> * BlockBackends. If there is still any other user like a block job, then
> * we simply can't inactivate the image. */
> - if (!blk->dev && !blk->name[0]) {
> + if (!blk->dev && !blk_name(blk)[0]) {
> return -EPERM;
> }
>
> --
> 1.8.3.1
>
>
Reviewed-by: Jeff Cody <address@hidden>