From patchwork Thu Mar 10 12:13:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 8556881 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DCDFFC0553 for ; Thu, 10 Mar 2016 12:15:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 43C252034F for ; Thu, 10 Mar 2016 12:15:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 89C3C20303 for ; Thu, 10 Mar 2016 12:15:01 +0000 (UTC) Received: from localhost ([::1]:47854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adzUa-00072y-UZ for patchwork-qemu-devel@patchwork.kernel.org; Thu, 10 Mar 2016 07:15:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adzUS-00072q-KX for qemu-devel@nongnu.org; Thu, 10 Mar 2016 07:14:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adzUN-00045x-Kv for qemu-devel@nongnu.org; Thu, 10 Mar 2016 07:14:52 -0500 Received: from smtp3.mundo-r.com ([212.51.32.191]:59214 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adzUN-00044x-EU; Thu, 10 Mar 2016 07:14:47 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2AbBAAYZOFW/5tjdVteGQEBAhMBgw2BP6ZoCwUBgQ+QQoITAQ2BbRKFfYFAOBQBAQEBAQEBZCdBEgGEG1JPTjSIKAG9WoVQihCDbgWXPI14AokrhVACRI4mHgEBQoE2AYIvaIdXgXwBAQE X-IPAS-Result: A2AbBAAYZOFW/5tjdVteGQEBAhMBgw2BP6ZoCwUBgQ+QQoITAQ2BbRKFfYFAOBQBAQEBAQEBZCdBEgGEG1JPTjSIKAG9WoVQihCDbgWXPI14AokrhVACRI4mHgEBQoE2AYIvaIdXgXwBAQE X-IronPort-AV: E=Sophos;i="5.24,315,1454972400"; d="scan'208";a="98067674" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 10 Mar 2016 13:14:33 +0100 Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim) id 1adzU9-0000M5-7Z; Thu, 10 Mar 2016 13:14:33 +0100 Received: from berto by perseus.local with local (Exim 4.86_2) (envelope-from ) id 1adzTt-0002LC-By; Thu, 10 Mar 2016 14:14:17 +0200 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Thu, 10 Mar 2016 14:13:56 +0200 Message-Id: <1457612036-8953-1-git-send-email-berto@igalia.com> X-Mailer: git-send-email 2.7.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.51.32.191 Cc: Alberto Garcia , qemu-stable@nongnu.org, Max Reitz Subject: [Qemu-devel] [PATCH] quorum: Fix crash in quorum_aio_cb() 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP quorum_aio_cb() emits the QUORUM_REPORT_BAD event if there's an I/O error in a Quorum child. However sacb->aiocb must be correctly initialized for this to happen. read_quorum_children() and read_fifo_child() are not doing this, which results in a QEMU crash. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz Reviewed-by: Wen Congyang --- block/quorum.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/block/quorum.c b/block/quorum.c index b9ba028..e640688 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -646,8 +646,9 @@ static BlockAIOCB *read_quorum_children(QuorumAIOCB *acb) } for (i = 0; i < s->num_children; i++) { - bdrv_aio_readv(s->children[i]->bs, acb->sector_num, &acb->qcrs[i].qiov, - acb->nb_sectors, quorum_aio_cb, &acb->qcrs[i]); + acb->qcrs[i].aiocb = bdrv_aio_readv(s->children[i]->bs, acb->sector_num, + &acb->qcrs[i].qiov, acb->nb_sectors, + quorum_aio_cb, &acb->qcrs[i]); } return &acb->common; @@ -662,9 +663,10 @@ static BlockAIOCB *read_fifo_child(QuorumAIOCB *acb) qemu_iovec_init(&acb->qcrs[acb->child_iter].qiov, acb->qiov->niov); qemu_iovec_clone(&acb->qcrs[acb->child_iter].qiov, acb->qiov, acb->qcrs[acb->child_iter].buf); - bdrv_aio_readv(s->children[acb->child_iter]->bs, acb->sector_num, - &acb->qcrs[acb->child_iter].qiov, acb->nb_sectors, - quorum_aio_cb, &acb->qcrs[acb->child_iter]); + acb->qcrs[acb->child_iter].aiocb = + bdrv_aio_readv(s->children[acb->child_iter]->bs, acb->sector_num, + &acb->qcrs[acb->child_iter].qiov, acb->nb_sectors, + quorum_aio_cb, &acb->qcrs[acb->child_iter]); return &acb->common; }