From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O0Ao8-0004Iw-RQ for qemu-devel@nongnu.org; Fri, 09 Apr 2010 05:47:24 -0400 Received: from [140.186.70.92] (port=44286 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0Ao6-0004HP-AJ for qemu-devel@nongnu.org; Fri, 09 Apr 2010 05:47:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O0Ao3-0005wp-5a for qemu-devel@nongnu.org; Fri, 09 Apr 2010 05:47:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25709) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O0Ao2-0005wS-Ua for qemu-devel@nongnu.org; Fri, 09 Apr 2010 05:47:19 -0400 From: Kevin Wolf Date: Fri, 9 Apr 2010 11:46:24 +0200 Message-Id: <1270806388-28138-7-git-send-email-kwolf@redhat.com> In-Reply-To: <1270806388-28138-1-git-send-email-kwolf@redhat.com> References: <1270806388-28138-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [STABLE][PATCH 06/10] block: Fix multiwrite error handling List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aurelien@aurel32.net Cc: kwolf@redhat.com, qemu-devel@nongnu.org When two requests of the same multiwrite batch fail, the callback of all requests in that batch were called twice. This could have any kind of nasty effects, in my case it lead to use after free and eventually a segfault. Signed-off-by: Kevin Wolf --- block.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block.c b/block.c index 9697dc9..06e22a6 100644 --- a/block.c +++ b/block.c @@ -1617,7 +1617,7 @@ static void multiwrite_cb(void *opaque, int ret) { MultiwriteCB *mcb = opaque; - if (ret < 0) { + if (ret < 0 && !mcb->error) { mcb->error = ret; multiwrite_user_cb(mcb); } -- 1.6.6.1