From patchwork Mon Aug 6 12:49:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 175343 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 332892C008D for ; Mon, 6 Aug 2012 22:49:24 +1000 (EST) Received: from localhost ([::1]:58516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyMkM-0000HJ-9E for incoming@patchwork.ozlabs.org; Mon, 06 Aug 2012 08:49:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42985) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyMkE-0000H6-Jh for qemu-devel@nongnu.org; Mon, 06 Aug 2012 08:49:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SyMk8-0002Pj-OM for qemu-devel@nongnu.org; Mon, 06 Aug 2012 08:49:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59933) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyMk8-0002PY-BK for qemu-devel@nongnu.org; Mon, 06 Aug 2012 08:49:08 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q76Cn7UV030409 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 6 Aug 2012 08:49:07 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q76Cn6Dt018010; Mon, 6 Aug 2012 08:49:06 -0400 From: Avi Kivity To: Kevin Wolf Date: Mon, 6 Aug 2012 15:49:03 +0300 Message-Id: <1344257343-11298-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH master/stable] virtio-mlk: fix use-after-free while handling scsi commands 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 The scsi passthrough handler falls through after completing a request into the failure path, resulting in a use after free. Reprducible by running a guest with aio=native on a block device. Reported-by: Stefan Priebe Signed-off-by: Avi Kivity Reviewed-by: Stefan Hajnoczi --- hw/virtio-blk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index f21757e..552b3b6 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -254,6 +254,7 @@ static void virtio_blk_handle_scsi(VirtIOBlockReq *req) virtio_blk_req_complete(req, status); g_free(req); + return; #else abort(); #endif