From patchwork Tue Jun 7 14:19:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 9161475 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7C6E060572 for ; Tue, 7 Jun 2016 14:20:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C58E25404 for ; Tue, 7 Jun 2016 14:20:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6096B2793B; Tue, 7 Jun 2016 14:20:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.9 required=2.0 tests=BAYES_00,FSL_HELO_HOME, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3EAAE25404 for ; Tue, 7 Jun 2016 14:20:15 +0000 (UTC) Received: from localhost ([::1]:50156 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAHra-0000kX-E5 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Jun 2016 10:20:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAHqc-0000Dr-Vz for qemu-devel@nongnu.org; Tue, 07 Jun 2016 10:19:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAHqZ-00059m-RV for qemu-devel@nongnu.org; Tue, 07 Jun 2016 10:19:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50893) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAHqZ-00059i-Lu for qemu-devel@nongnu.org; Tue, 07 Jun 2016 10:19:11 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F1ED37E64; Tue, 7 Jun 2016 14:19:11 +0000 (UTC) Received: from t530wlan.home.berrange.com.com (vpn1-4-63.ams2.redhat.com [10.36.4.63]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u57EJ9JJ018109; Tue, 7 Jun 2016 10:19:10 -0400 From: "Daniel P. Berrange" To: qemu-devel@nongnu.org Date: Tue, 7 Jun 2016 15:19:05 +0100 Message-Id: <1465309145-6224-1-git-send-email-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 07 Jun 2016 14:19:11 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] io: remove mistaken call to object_ref on QTask X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Aitchison Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reported-by: Ben Aitchison Signed-off-by: Daniel P. Berrange Reviewed-by: Eric Blake --- 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 239c75a..533bd4b 100644 --- a/io/channel-websock.c +++ b/io/channel-websock.c @@ -317,14 +317,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; }