Received: from eggs.gnu.org ([2001:4830:134:3::10]:41883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWrkA-000425-FL for qemu-devel@nongnu.org; Mon, 08 Aug 2016 17:05:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWrk6-0005xI-Qu for qemu-devel@nongnu.org; Mon, 08 Aug 2016 17:05:54 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:45026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWrk6-0005x6-IM for qemu-devel@nongnu.org; Mon, 08 Aug 2016 17:05:50 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u78KxkMW121739 for ; Mon, 8 Aug 2016 17:05:50 -0400 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0a-001b2d01.pphosted.com with ESMTP id 24nce8fuh3-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 08 Aug 2016 17:05:49 -0400 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 Aug 2016 15:05:49 -0600 From: Michael Roth Date: Mon, 8 Aug 2016 16:04:01 -0500 In-Reply-To: <1470690267-31454-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1470690267-31454-1-git-send-email-mdroth@linux.vnet.ibm.com> Message-Id: <1470690267-31454-31-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 30/56] io: remove mistaken call to object_ref on QTask List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, "Daniel P. Berrange" From: "Daniel P. Berrange" The QTask struct is just a standalone struct, not a QOM Object, so calling object_ref() on it is not appropriate. This results in mangling the 'destroy' field in the QTask struct, causing the later call to qtask_free() to try to call the function at address 0x1, with predictably segfault happy results. There is in fact no need for ref counting with QTask, as the call to qtask_abort() or qtask_complete() will automatically free associated memory. This fixes the crash shown in https://bugs.launchpad.net/qemu/+bug/1589923 Reviewed-by: Eric Blake Signed-off-by: Daniel P. Berrange (cherry picked from commit bc35d51077b33e68a0ab10a057f352747214223f) Signed-off-by: Michael Roth --- io/channel-websock.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/io/channel-websock.c b/io/channel-websock.c index 7081787..d5a4ed3 100644 --- a/io/channel-websock.c +++ b/io/channel-websock.c @@ -316,14 +316,13 @@ static gboolean qio_channel_websock_handshake_io(QIOChannel *ioc, return TRUE; } - object_ref(OBJECT(task)); trace_qio_channel_websock_handshake_reply(ioc); qio_channel_add_watch( wioc->master, G_IO_OUT, qio_channel_websock_handshake_send, task, - (GDestroyNotify)object_unref); + NULL); return FALSE; } -- 1.9.1