aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2011-07-20 18:23:36 +0200
committerKevin Wolf <kwolf@redhat.com>2011-08-01 12:09:11 +0200
commita19712b0dbe43016fb17ec48bfff2f360225fe97 (patch)
tree1e1b763a767b8aa21a3c75d56f4fe7449a9d2935 /block.c
parentea8f942fe46dd10e0946f02ab9d698fb41e958f7 (diff)
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>
Diffstat (limited to 'block.c')
-rw-r--r--block.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block.c b/block.c
index 9549b9eff9..81a82578a2 100644
--- a/block.c
+++ b/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)