On 20.10.2015 10:33, Kevin Wolf wrote: > 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 <mre...@redhat.com> >> --- >> 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?
Yes, indeed, will fix. Max >> + blk->bs = NULL; >> +} > > Kevin >
signature.asc
Description: OpenPGP digital signature