From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Sun, 3 Jul 2011 18:09:34 +0200 Message-Id: <1309709374-9274-1-git-send-email-hpoussin@reactos.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH] esp: cancel current request only if some request is in flight List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Some device may be selected, but it doesn't mean that a request is pendin= g. This fixes a possible crash of Qemu. Signed-off-by: Herv=C3=A9 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 =3D 0; s->ti_wptr =3D 0; =20 - 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 =3D 0; --=20 1.7.5.4