qemu-devel
[Top][All Lists]
Advanced

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

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


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH v7 27/39] block: Add blk_remove_bs()
Date: Wed, 21 Oct 2015 15:47:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

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 <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?

Yes, indeed, will fix.

Max

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


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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