From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:35424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjZZk-0003jl-5h for qemu-devel@nongnu.org; Wed, 20 Jul 2011 12:24:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QjZZb-0008NO-9E for qemu-devel@nongnu.org; Wed, 20 Jul 2011 12:24:41 -0400 Received: from oxygen.pond.sub.org ([78.46.104.156]:55484) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjZZa-0008Mu-V6 for qemu-devel@nongnu.org; Wed, 20 Jul 2011 12:24:35 -0400 From: Markus Armbruster Date: Wed, 20 Jul 2011 18:23:36 +0200 Message-Id: <1311179069-27882-3-git-send-email-armbru@redhat.com> In-Reply-To: <1311179069-27882-1-git-send-email-armbru@redhat.com> References: <1311179069-27882-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH 02/55] block: Reset device model callbacks on detach List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, quintela@redhat.com, dbaryshkov@gmail.com, stefano.stabellini@eu.citrix.com, lcapitulino@redhat.com, amit.shah@redhat.com 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 --- block.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/block.c b/block.c index 24a25d5..c49a825 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.2.3