From nobody Thu May 2 23:50:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532007054932624.6297807283339; Thu, 19 Jul 2018 06:30:54 -0700 (PDT) Received: from localhost ([::1]:42642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fg8e4-00077T-Dz for importer@patchew.org; Thu, 19 Jul 2018 09:07:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fg8b3-00057H-CR for qemu-devel@nongnu.org; Thu, 19 Jul 2018 09:05:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fg8ZH-0000K9-45 for qemu-devel@nongnu.org; Thu, 19 Jul 2018 09:03:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43890 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fg8ZG-0000JT-Oy for qemu-devel@nongnu.org; Thu, 19 Jul 2018 09:02:02 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C463401EF09; Thu, 19 Jul 2018 13:02:02 +0000 (UTC) Received: from thh440s.str.redhat.com (dhcp-200-180.str.redhat.com [10.33.200.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63BBB2156700; Thu, 19 Jul 2018 13:02:01 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Max Filippov Date: Thu, 19 Jul 2018 15:02:00 +0200 Message-Id: <1532005320-17794-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 19 Jul 2018 13:02:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 19 Jul 2018 13:02:02 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH] target/xtensa/cpu: Set owner of memory region in xtensa_cpu_initfn 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: Peter Maydell , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The instance_init function of the xtensa CPUs creates a memory region, but does not set an owner, so the memory region is not destroyed correctly when the CPU object is removed. This can happen when introspecting the CPU devices, so introspecting the CPU device will leave a dangling memory region object in the QOM tree. Make sure to set the right owner here to fix this issue. Signed-off-by: Thomas Huth Acked-by: Max Filippov --- target/xtensa/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index b50c840..590813d 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -149,7 +149,7 @@ static void xtensa_cpu_initfn(Object *obj) #ifndef CONFIG_USER_ONLY env->address_space_er =3D g_malloc(sizeof(*env->address_space_er)); env->system_er =3D g_malloc(sizeof(*env->system_er)); - memory_region_init_io(env->system_er, NULL, NULL, env, "er", + memory_region_init_io(env->system_er, obj, NULL, env, "er", UINT64_C(0x100000000)); address_space_init(env->address_space_er, env->system_er, "ER"); #endif --=20 1.8.3.1