From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QocAZ-00008a-5n for qemu-devel@nongnu.org; Wed, 03 Aug 2011 10:11:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QocAX-0007Rn-R7 for qemu-devel@nongnu.org; Wed, 03 Aug 2011 10:11:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18631) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QocAX-0007Rh-K9 for qemu-devel@nongnu.org; Wed, 03 Aug 2011 10:11:33 -0400 From: Kevin Wolf Date: Wed, 3 Aug 2011 16:13:57 +0200 Message-Id: <1312380864-15605-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1312380864-15605-1-git-send-email-kwolf@redhat.com> References: <1312380864-15605-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 02/29] block: Reset device model callbacks on detach List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Markus Armbruster 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 Signed-off-by: Kevin Wolf --- 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