[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 02/29] block: Reset device model callbacks on detach
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 02/29] block: Reset device model callbacks on detach |
Date: |
Wed, 3 Aug 2011 16:13:57 +0200 |
From: Markus Armbruster <address@hidden>
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 <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/block.c b/block.c
index 9549b9e..81a8257 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)
--
1.7.6
- [Qemu-devel] [PULL 00/29] Block patches, Kevin Wolf, 2011/08/03
- [Qemu-devel] [PATCH 01/29] blockdev: Make eject fail for non-removable drives even with -f, Kevin Wolf, 2011/08/03
- [Qemu-devel] [PATCH 02/29] block: Reset device model callbacks on detach,
Kevin Wolf <=
- [Qemu-devel] [PATCH 04/29] block: Make BlockDriver method bdrv_set_locked() return void, Kevin Wolf, 2011/08/03
- [Qemu-devel] [PATCH 03/29] block/raw-win32: Drop disabled code for removable host devices, Kevin Wolf, 2011/08/03
- [Qemu-devel] [PATCH 05/29] block: Make BlockDriver method bdrv_eject() return void, Kevin Wolf, 2011/08/03
- [Qemu-devel] [PATCH 06/29] block: Don't let locked flag prevent medium load, Kevin Wolf, 2011/08/03
- [Qemu-devel] [PATCH 07/29] block/vpc.c: Detect too-large vpc file, Kevin Wolf, 2011/08/03
- [Qemu-devel] [PATCH 09/29] scsi: Remove references to SET_WINDOW, Kevin Wolf, 2011/08/03
- [Qemu-devel] [PATCH 12/29] scsi-disk: Remove 'drive_kind', Kevin Wolf, 2011/08/03
- [Qemu-devel] [PATCH 11/29] scsi: Sanitize command definitions, Kevin Wolf, 2011/08/03
- [Qemu-devel] [PATCH 08/29] scsi-disk: Codingstyle fixes, Kevin Wolf, 2011/08/03
- [Qemu-devel] [PATCH 13/29] block: Removed unused function bdrv_write_sync, Kevin Wolf, 2011/08/03