qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH v7 27/39] block: Add blk_remove_bs()


From: Kevin Wolf
Subject: Re: [Qemu-block] [PATCH v7 27/39] block: Add blk_remove_bs()
Date: Tue, 20 Oct 2015 10:33:51 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 19.10.2015 um 17:53 hat Max Reitz geschrieben:
> This function removes the BlockDriverState associated with the given
> BlockBackend from that BB and sets the BDS pointer in the BB to NULL.
> 
> Signed-off-by: Max Reitz <address@hidden>
> ---
>  block/block-backend.c          | 12 ++++++++++++
>  include/sysemu/block-backend.h |  1 +
>  2 files changed, 13 insertions(+)
> 
> diff --git a/block/block-backend.c b/block/block-backend.c
> index 19fdaae..eb7409c 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -334,6 +334,18 @@ void blk_hide_on_behalf_of_hmp_drive_del(BlockBackend 
> *blk)
>  }
>  
>  /*
> + * Disassociates the currently associated BlockDriverState from @blk.
> + */
> +void blk_remove_bs(BlockBackend *blk)
> +{
> +    blk_update_root_state(blk);
> +
> +    bdrv_unref(blk->bs);
> +    blk->bs->blk = NULL;

Use after free?

> +    blk->bs = NULL;
> +}

Kevin



reply via email to

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