From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6efV-0004Ml-JB for qemu-devel@nongnu.org; Mon, 14 Jul 2014 07:43:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X6efN-0005HW-Lr for qemu-devel@nongnu.org; Mon, 14 Jul 2014 07:43:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46853) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6efN-0005HI-D1 for qemu-devel@nongnu.org; Mon, 14 Jul 2014 07:43:33 -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 s6EBhWDo010061 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Jul 2014 07:43:32 -0400 From: Kevin Wolf Date: Mon, 14 Jul 2014 13:43:01 +0200 Message-Id: <1405338192-18850-12-git-send-email-kwolf@redhat.com> In-Reply-To: <1405338192-18850-1-git-send-email-kwolf@redhat.com> References: <1405338192-18850-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL v2 for-2.1 11/22] virtio-blk: avoid dataplane VirtIOBlockReq early free List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com From: Stefan Hajnoczi VirtIOBlockReq is freed later by virtio_blk_free_request() in hw/block/virtio-blk.c. Remove this extraneous g_slice_free(). This patch fixes the following segfault: 0x00005555556373af in virtio_blk_rw_complete (opaque=0x5555565ff5e0, ret=0) at hw/block/virtio-blk.c:99 99 bdrv_acct_done(req->dev->bs, &req->acct); (gdb) print req $1 = (VirtIOBlockReq *) 0x5555565ff5e0 (gdb) print req->dev $2 = (VirtIOBlock *) 0x0 (gdb) bt #0 0x00005555556373af in virtio_blk_rw_complete (opaque=0x5555565ff5e0, ret=0) at hw/block/virtio-blk.c:99 #1 0x0000555555840ebe in bdrv_co_em_bh (opaque=0x5555566152d0) at block.c:4675 #2 0x000055555583de77 in aio_bh_poll (ctx=ctx@entry=0x5555563a8150) at async.c:81 #3 0x000055555584b7a7 in aio_poll (ctx=0x5555563a8150, blocking=blocking@entry=true) at aio-posix.c:188 #4 0x00005555556e520e in iothread_run (opaque=0x5555563a7fd8) at iothread.c:41 #5 0x00007ffff42ba124 in start_thread () from /usr/lib/libpthread.so.0 #6 0x00007ffff16d14bd in clone () from /usr/lib/libc.so.6 Reported-by: Max Reitz Cc: Fam Zheng Signed-off-by: Stefan Hajnoczi Tested-by: Christian Borntraeger Signed-off-by: Kevin Wolf --- hw/block/dataplane/virtio-blk.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index 4bc0729..bed9f13 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -68,7 +68,6 @@ static void complete_request_vring(VirtIOBlockReq *req, unsigned char status) vring_push(&req->dev->dataplane->vring, req->elem, req->qiov.size + sizeof(*req->in)); notify_guest(req->dev->dataplane); - g_slice_free(VirtIOBlockReq, req); } static void handle_notify(EventNotifier *e) -- 1.8.3.1