From patchwork Fri May 27 09:46:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 97667 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1F11FB6F8A for ; Fri, 27 May 2011 19:44:22 +1000 (EST) Received: from localhost ([::1]:36875 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPtad-0003ZS-0l for incoming@patchwork.ozlabs.org; Fri, 27 May 2011 05:44:19 -0400 Received: from eggs.gnu.org ([140.186.70.92]:44197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPtaW-0003ZN-Ud for qemu-devel@nongnu.org; Fri, 27 May 2011 05:44:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QPtaU-0000nr-WE for qemu-devel@nongnu.org; Fri, 27 May 2011 05:44:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57839) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPtaU-0000nk-OC for qemu-devel@nongnu.org; Fri, 27 May 2011 05:44:10 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4R9i9Nn002172 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 27 May 2011 05:44:09 -0400 Received: from dhcp-5-188.str.redhat.com (vpn2-11-132.ams2.redhat.com [10.36.11.132]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p4R9i7GT017839; Fri, 27 May 2011 05:44:08 -0400 From: Kevin Wolf To: qemu-devel@nongnu.org Date: Fri, 27 May 2011 11:46:58 +0200 Message-Id: <1306489618-9397-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com Subject: [Qemu-devel] [PATCH] blockdbg: Fix Bottom Half deletion X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org You can only delete a BH in its BH handler if you don't call a nested qemu_bh_poll afterwards (the nested one would free the BH and the outer one segfaults when returning from the BH handler). To avoid this situation, first call the callback and only then delete the BH. Signed-off-by: Kevin Wolf --- block/blkdebug.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block/blkdebug.c b/block/blkdebug.c index cd9eb80..45bbab8 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -316,8 +316,8 @@ static int blkdebug_open(BlockDriverState *bs, const char *filename, int flags) static void error_callback_bh(void *opaque) { struct BlkdebugAIOCB *acb = opaque; - qemu_bh_delete(acb->bh); acb->common.cb(acb->common.opaque, acb->ret); + qemu_bh_delete(acb->bh); qemu_aio_release(acb); }