mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
block: Reset device model callbacks on detach
BlockDriverState members change_cb and change_opaque are initially null. The device model may set them, with bdrv_set_change_cb(). If the device model gets detached (hot unplug), they're left dangling. Only safe because device hot unplug automatically destroys the BlockDriverState. But that's a questionable feature, best not to rely on it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
ea8f942fe4
commit
a19712b0db
1 changed files with 2 additions and 0 deletions
2
block.c
2
block.c
|
@ -730,6 +730,8 @@ void bdrv_detach(BlockDriverState *bs, DeviceState *qdev)
|
|||
{
|
||||
assert(bs->peer == qdev);
|
||||
bs->peer = NULL;
|
||||
bs->change_cb = NULL;
|
||||
bs->change_opaque = NULL;
|
||||
}
|
||||
|
||||
DeviceState *bdrv_get_attached(BlockDriverState *bs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue