From patchwork Sun Jul 3 16:09:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 103027 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 481EDB6F64 for ; Mon, 4 Jul 2011 02:13:25 +1000 (EST) Received: from localhost ([::1]:44546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdPIQ-00040E-2V for incoming@patchwork.ozlabs.org; Sun, 03 Jul 2011 12:13:22 -0400 Received: from eggs.gnu.org ([140.186.70.92]:49536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdPEx-0003ys-0i for qemu-devel@nongnu.org; Sun, 03 Jul 2011 12:09:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QdPEv-0003Xt-9U for qemu-devel@nongnu.org; Sun, 03 Jul 2011 12:09:46 -0400 Received: from smtp5-g21.free.fr ([212.27.42.5]:38798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdPEu-0003XS-IL for qemu-devel@nongnu.org; Sun, 03 Jul 2011 12:09:45 -0400 Received: from localhost.localdomain (unknown [88.171.126.33]) by smtp5-g21.free.fr (Postfix) with ESMTP id 1BF30D4810C; Sun, 3 Jul 2011 18:09:29 +0200 (CEST) From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= To: qemu-devel@nongnu.org Date: Sun, 3 Jul 2011 18:09:34 +0200 Message-Id: <1309709374-9274-1-git-send-email-hpoussin@reactos.org> X-Mailer: git-send-email 1.7.5.4 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 212.27.42.5 Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Subject: [Qemu-devel] [PATCH] esp: cancel current request only if some request is in flight 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 Some device may be selected, but it doesn't mean that a request is pending. This fixes a possible crash of Qemu. Signed-off-by: Hervé Poussineau --- hw/esp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/esp.c b/hw/esp.c index 8e95672..aa50800 100644 --- a/hw/esp.c +++ b/hw/esp.c @@ -219,7 +219,7 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf) s->ti_rptr = 0; s->ti_wptr = 0; - if (s->current_dev) { + if (s->current_req) { /* Started a new command before the old one finished. Cancel it. */ scsi_req_cancel(s->current_req); s->async_len = 0;