From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUVHn-0005RG-8N for qemu-devel@nongnu.org; Tue, 02 Aug 2016 04:43:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUVHg-0004KY-Bf for qemu-devel@nongnu.org; Tue, 02 Aug 2016 04:42:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49672) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUVHg-0004KU-5v for qemu-devel@nongnu.org; Tue, 02 Aug 2016 04:42:44 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (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 9890B3DE40 for ; Tue, 2 Aug 2016 08:42:43 +0000 (UTC) Date: Tue, 2 Aug 2016 16:42:41 +0800 From: Fam Zheng Message-ID: <20160802084241.GD2095@ad.usersys.redhat.com> References: <1470109301-12966-1-git-send-email-famz@redhat.com> <20160802095507.6055409b@nial.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160802095507.6055409b@nial.brq.redhat.com> Subject: Re: [Qemu-devel] [PATCH] qdev: Fix use after free in qdev_init_nofail error path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, jsnow@redhat.com, ehabkost@redhat.com On Tue, 08/02 09:55, Igor Mammedov wrote: > qdev_init_nofail() { called with ref == 1 Yes it does. > object_property_set_bool(true, "realized") > if error: > ref == 1 ^ This is not the case for qdev, the object is actually released by object_property_set_bool if fail. The problem seems to be that qdev_create doesn't set OBJECT(dev)->parent, because it eventually calls object_property_add_link instead of object_property_add_child. > else: > ref == 2 (+1 for implicitly assigned parent) > } Fam