{"id":2232342,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2232342/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260504-qom-tests-v2-16-ef7e3dc94f7a@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.1/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260504-qom-tests-v2-16-ef7e3dc94f7a@redhat.com>","date":"2026-05-04T11:35:04","name":"[v2,16/46] system/ioport: Fix qom-list-properties crash on portio list obj","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"d12109463e013f48a6466148b9f397468d6fa0e5","submitter":{"id":66774,"url":"http://patchwork.ozlabs.org/api/1.1/people/66774/?format=json","name":"Marc-André Lureau","email":"marcandre.lureau@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260504-qom-tests-v2-16-ef7e3dc94f7a@redhat.com/mbox/","series":[{"id":502649,"url":"http://patchwork.ozlabs.org/api/1.1/series/502649/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502649","date":"2026-05-04T11:34:48","name":"Fix various QOM object life-cycle issues","version":2,"mbox":"http://patchwork.ozlabs.org/series/502649/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2232342/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2232342/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=JpWRXBLn;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g8KQd47qXz1yKS\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 04 May 2026 21:38:17 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wJrbq-0000s4-DV; Mon, 04 May 2026 07:37:11 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1wJrbX-0000Hj-KT\n for qemu-devel@nongnu.org; Mon, 04 May 2026 07:36:52 -0400","from us-smtp-delivery-124.mimecast.com ([170.10.129.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1wJrbV-0000zq-NJ\n for qemu-devel@nongnu.org; Mon, 04 May 2026 07:36:51 -0400","from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-147-cqOgIstqNLq9FGGxZ15TAw-1; Mon,\n 04 May 2026 07:36:46 -0400","from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id BCA41180034C; Mon,  4 May 2026 11:36:45 +0000 (UTC)","from localhost (unknown [10.44.24.4])\n by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 71EF219560A6; Mon,  4 May 2026 11:36:44 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1777894608;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=WA7HCr6BRcLTeqx4HsKUg3WORqn8eiFYwWxgxz8jrOY=;\n b=JpWRXBLnLhY7ZhA+NfWHnyGBM3+t5n6spRlO+wneN2fxrrq/ZbHY8chm+zKe/it2OjAJku\n GshjBWF9Ay3mbmpYAG3GFCOtkm4nLQOrniU7eslDpgPwBLoZgmKatMidipUda7DWSxRSCH\n wPpGDNr7/k6BPQcEjIrXGoLuinrvSns=","X-MC-Unique":"cqOgIstqNLq9FGGxZ15TAw-1","X-Mimecast-MFC-AGG-ID":"cqOgIstqNLq9FGGxZ15TAw_1777894605","From":"marcandre.lureau@redhat.com","Date":"Mon, 04 May 2026 15:35:04 +0400","Subject":"[PATCH v2 16/46] system/ioport: Fix qom-list-properties crash on\n portio list obj","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"8bit","Message-Id":"<20260504-qom-tests-v2-16-ef7e3dc94f7a@redhat.com>","References":"<20260504-qom-tests-v2-0-ef7e3dc94f7a@redhat.com>","In-Reply-To":"<20260504-qom-tests-v2-0-ef7e3dc94f7a@redhat.com>","To":"qemu-devel@nongnu.org","Cc":"armbru@redhat.com,\n =?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n  Peter Xu <peterx@redhat.com>,\n  Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>","X-Developer-Signature":"v=1; a=openpgp-sha256; l=1608;\n i=marcandre.lureau@redhat.com; h=from:subject:message-id;\n bh=OiojSRVbGrDtH2nEC2hxpx2beSqgCFB6TOBqj8+YtAk=;\n b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBp+IRsP7CyQfyq6qKr1yVRRE2pUfqrXKwRoezQn\n MZ2EWNfkjKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCafiEbAAKCRDa6OEJdZac\n 5cCgD/0UN3lXBmEslYfzE732Gn6/8UEPqTUft3IfE9TODBxP0G9ttQWDyhX+/+eBGBfHbPARhiY\n OUvDtZBE6I7HlLQYgBR2VVd3t5blDGIOM9WH2wVC8jFCKNq1n+NCyIyI+0aBrtgnbGaeC/X/OSh\n 50gtot4GdmK8lupw3SDbYCP9uh4TEgMatbSSk8H2GpKshLampPR3V8Q6QEjQeSQDdv9rUZEe3rn\n um9xDRdR6SIxxdp9fCU8qHvjpS2sO4uLE9AfmMIJuqnHXl0QAosi9M/b7gxcYw03hAzhxJBxfeq\n +6UF+79zGAwI8tCN9CYZyosK5w4kqSlFi3KsUxyw4HPGSqGaVEpKI4IJPa0QAsdnrKDU5ar53SU\n PBFtxQyVUXG0PCgnrgn9FWI3fbN4CNT2wq9P2qcWR46Fn5YA3f4iBMDLOdmuJLbTsWxB5avHeBT\n gIQZpC8t1Mb6g6lFfEOwQ58zswAoiN52c7VAu9FWlNkbeLmRDMuL/5Rpidy3gpxu7LKRtqWR9pd\n 8ohGdF0fxGNW7Gid36YNNIXgx9mG+RJv0PTnYjb4Z7Qna/KTnpwK9TR8Rcv2SV8PEfiH1pKofFr\n ARtmxC7iw6o1AXhpy8UlMZL0pfaZKcHJxfVy9fA0Di2UcwQaShTd58Y+dmO9i6rWh6YFkEoQuLx\n 1y5p6bvLpw9CE/A==","X-Developer-Key":"i=marcandre.lureau@redhat.com; a=openpgp;\n fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.12","Received-SPF":"pass client-ip=170.10.129.124;\n envelope-from=marcandre.lureau@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com","X-Spam_score_int":"-24","X-Spam_score":"-2.5","X-Spam_bar":"--","X-Spam_report":"(-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.444,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"From: Peter Xu <peterx@redhat.com>\n\nCurrently qom-list-properties QMP command will crash when querying the\nportio list MR object.  It's because its finalize() assumes full\ninitialization done in portio_list_add_1().\n\nProvide a simple fix for now to avoid the crash.  There is chance for a\nlonger term fix, ideally MR should be initialized in instance_init().\n\nHowever that'll need more work, and that should also be done with cleaning\nthe hard-coded MR operations in portio_list_add_1().  To be explored.\n\nCc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>\nLink: https://lore.kernel.org/r/87a4uvw066.fsf@pond.sub.org\nReported-by: Markus Armbruster <armbru@redhat.com>\nReviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>\nSigned-off-by: Peter Xu <peterx@redhat.com>\n---\n system/ioport.c | 11 +++++++++--\n 1 file changed, 9 insertions(+), 2 deletions(-)","diff":"diff --git a/system/ioport.c b/system/ioport.c\nindex 303fabf063e..0a1b80f2994 100644\n--- a/system/ioport.c\n+++ b/system/ioport.c\n@@ -345,8 +345,15 @@ static void memory_region_portio_list_finalize(Object *obj)\n {\n     MemoryRegionPortioList *mrpio = MEMORY_REGION_PORTIO_LIST(obj);\n \n-    object_unref(&mrpio->mr);\n-    g_free(mrpio->ports);\n+    /*\n+     * This check makes sure any random object_new() (without doing the\n+     * rest inits in portio_list_add_1()) will not crash when finalizing.\n+     * One example is QMP command qom-list-properties.\n+     */\n+    if (mrpio->ports) {\n+        object_unref(&mrpio->mr);\n+        g_free(mrpio->ports);\n+    }\n }\n \n static const TypeInfo memory_region_portio_list_info = {\n","prefixes":["v2","16/46"]}