From patchwork Thu Jul 28 22:50:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 9251781 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 24AD16075F for ; Thu, 28 Jul 2016 22:51:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 152A627F54 for ; Thu, 28 Jul 2016 22:51:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 056B427F85; Thu, 28 Jul 2016 22:51:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 9D6FC27F54 for ; Thu, 28 Jul 2016 22:51:34 +0000 (UTC) Received: from localhost ([::1]:56131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSu9N-00078L-3S for patchwork-qemu-devel@patchwork.kernel.org; Thu, 28 Jul 2016 18:51:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSu8x-00077p-OG for qemu-devel@nongnu.org; Thu, 28 Jul 2016 18:51:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSu8t-0006uo-2U for qemu-devel@nongnu.org; Thu, 28 Jul 2016 18:51:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52918) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSu8s-0006uW-TU for qemu-devel@nongnu.org; Thu, 28 Jul 2016 18:51:03 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EFC98C049D59; Thu, 28 Jul 2016 22:51:01 +0000 (UTC) Received: from scv.usersys.redhat.com (dhcp-17-171.bos.redhat.com [10.18.17.171]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6SMp0L2010623; Thu, 28 Jul 2016 18:51:01 -0400 From: John Snow To: qemu-devel@nongnu.org Date: Thu, 28 Jul 2016 18:50:58 -0400 Message-Id: <1469746258-22438-2-git-send-email-jsnow@redhat.com> In-Reply-To: <1469746258-22438-1-git-send-email-jsnow@redhat.com> References: <1469746258-22438-1-git-send-email-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 28 Jul 2016 22:51:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/1] ide: fix halted IO segfault at reset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP If one attempts to perform a system_reset after a failed IO request that causes the VM to enter a paused state, QEMU will segfault trying to free up the pending IO requests. These requests have already been completed and freed, though, so all we need to do is NULL them before we enter the paused state. Existing AHCI tests verify that halted requests are still resumed successfully after a STOP event. Analyzed-by: Laszlo Ersek Reviewed-by: Laszlo Ersek Signed-off-by: John Snow Message-id: 1469635201-11918-2-git-send-email-jsnow@redhat.com Signed-off-by: John Snow --- hw/ide/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/ide/core.c b/hw/ide/core.c index 081c9eb..d117b7c 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -823,6 +823,7 @@ static void ide_dma_cb(void *opaque, int ret) } if (ret < 0) { if (ide_handle_rw_error(s, -ret, ide_dma_cmd_to_retry(s->dma_cmd))) { + s->bus->dma->aiocb = NULL; return; } }