From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMh9u-0003eG-LF for qemu-devel@nongnu.org; Wed, 27 Aug 2014 13:37:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMh9i-0002xR-0l for qemu-devel@nongnu.org; Wed, 27 Aug 2014 13:37:22 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:44700) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMh9h-0002xF-Qp for qemu-devel@nongnu.org; Wed, 27 Aug 2014 13:37:09 -0400 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 27 Aug 2014 13:37:09 -0400 From: Michael Roth Date: Wed, 27 Aug 2014 12:36:09 -0500 Message-Id: <1409160982-16389-13-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1409160982-16389-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1409160982-16389-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 12/25] virtio-blk: fix reference a pointer which might be freed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org From: zhanghailiang In function virtio_blk_handle_request, it may freed memory pointed by req, So do not access member of req after calling this function. Cc: qemu-stable@nongnu.org Reviewed-by: Michael S. Tsirkin Reviewed-by: Stefan Hajnoczi Signed-off-by: zhanghailiang Signed-off-by: Kevin Wolf (cherry picked from commit 1bdb176ac5add5dc9d54a230da7511b66851f1e7) Signed-off-by: Michael Roth --- hw/block/virtio-blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index c241c50..0e3925b 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -469,8 +469,9 @@ static void virtio_blk_dma_restart_bh(void *opaque) s->rq = NULL; while (req) { + VirtIOBlockReq *next = req->next; virtio_blk_handle_request(req, &mrb); - req = req->next; + req = next; } virtio_submit_multiwrite(s->bs, &mrb); -- 1.9.1