From patchwork Wed Dec 13 13:00:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 753516 Delivered-To: patch@linaro.org Received: by 2002:adf:ff85:0:b0:336:3f68:820c with SMTP id j5csp180791wrr; Wed, 13 Dec 2023 05:03:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGIf+6pokc7TzYEP17Z4/IEOeKZXk+xBH8U8Bn587iwmAqglZ7vLRITD3KHC1OBm2q5xF/ X-Received: by 2002:a05:6102:942:b0:464:77f2:55e with SMTP id a2-20020a056102094200b0046477f2055emr5240070vsi.48.1702472604128; Wed, 13 Dec 2023 05:03:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702472604; cv=none; d=google.com; s=arc-20160816; b=tvWnSlnCQvl5vHllJ1+YSc9BaG6oO4/+lmxmkC9hj1TwcCQSs46g5d3thCORvFvyqk nWDnsntJNTN3DGwaBD21lks0aQFp6SaRt/8F9iG0ZvKIV31+51TJ/M/rPKBz1i6W+Iqg 7c1i/iNXl4Vp13VrMxQZPzNpfuE93Zn3oO9GJrgdFwSAfQmhRxDsxtWdBzaUFrV8Zpzq mdUPDsY2y69UlL8h+6Qe4x9odUtBLodnfHbY3cJuVcxrbx8ZHYyeWlwjMuJQXNY3Efw/ 7irjjHadg6KR51/RgwvrcPWBicbkfxG3ZF7yxPt9pnf873CoSqREWHrqJ5og7UHuAeb4 cpIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=qGQz/jE/sFM047+EWZMtPX7y9WaU6Lnbw5Cw9Csejk0=; fh=PenDYrn8i21Yvsbn+uxcw5oiVY7iec7IJ9Kf8KemhZE=; b=lJWAMthOA6eztsEC1KHFx/RlzP4/8utwBirF3+80DaN20XKd8CeZVqoeriCUicB/B8 T2zdVAETuVh3wSZPUWz6MLyl/uVskyDQGj53j07NTO1m7rt2TPKZyeFfN2R/k5rnsy6O V5ZZ2++VvyZclgsq2HFdw+9J1RMpNnQH5Xh4M5FbBkvNjaZFQVVC5YP/HjZaUCLACp3F 358+XdmM1dz/nprt1HKACyukTQyv0Z5qb0Wi5mWkJeP31KnL6Dsh3f9poiXrIhG1jnLe EgMO2NDPEWl97V3Nez842zZx+QK4103eHT/9ROoSSDmBFNr3t37v59uYz04268YdRA7k 59zg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l27-20020a056102051b00b00465fbc32655si1989740vsa.33.2023.12.13.05.03.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Dec 2023 05:03:24 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rDOs1-0008IU-JJ; Wed, 13 Dec 2023 08:01:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rDOrY-000865-Al; Wed, 13 Dec 2023 08:01:22 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rDOrV-0006zd-Cm; Wed, 13 Dec 2023 08:01:19 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 54C683B43C; Wed, 13 Dec 2023 16:01:01 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id EC9683C8CD; Wed, 13 Dec 2023 16:00:41 +0300 (MSK) Received: (nullmailer pid 1024720 invoked by uid 1000); Wed, 13 Dec 2023 13:00:41 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eric Auger , Peter Maydell , Michael Tokarev Subject: [Stable-7.2.8 09/24] hw/virtio: Free VirtIOIOMMUPCI::vdev.reserved_regions[] on finalize() Date: Wed, 13 Dec 2023 16:00:18 +0300 Message-Id: <20231213130041.1024630-9-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Commit 0be6bfac62 ("qdev: Implement variable length array properties") added the DEFINE_PROP_ARRAY() macro with the following comment: * It is the responsibility of the device deinit code to free the * @_arrayfield memory. Commit 8077b8e549 added: DEFINE_PROP_ARRAY("reserved-regions", VirtIOIOMMUPCI, vdev.nb_reserved_regions, vdev.reserved_regions, qdev_prop_reserved_region, ReservedRegion), but forgot to free the 'vdev.reserved_regions' array. Do it in the instance_finalize() handler. Cc: qemu-stable@nongnu.org Fixes: 8077b8e549 ("virtio-iommu-pci: Add array of Interval properties") # v5.1.0+ Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger Message-id: 20231121174051.63038-3-philmd@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell (cherry picked from commit c9a4aa06dfce0fde1e279e1ea0c1945582ec0d16) Signed-off-by: Michael Tokarev (Mjt: fixup hw/virtio/virtio-iommu-pci.c for before v8.1.0-2552-g41cc70cdf5, "virtio-iommu: Rename reserved_regions into prop_resv_regions" -- so now patch subject matches actual change again) diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c index 7ef2f9dcdb..eab6e1c793 100644 --- a/hw/virtio/virtio-iommu-pci.c +++ b/hw/virtio/virtio-iommu-pci.c @@ -95,10 +95,18 @@ static void virtio_iommu_pci_instance_init(Object *obj) TYPE_VIRTIO_IOMMU); } +static void virtio_iommu_pci_instance_finalize(Object *obj) +{ + VirtIOIOMMUPCI *dev = VIRTIO_IOMMU_PCI(obj); + + g_free(dev->vdev.reserved_regions); +} + static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info = { .generic_name = TYPE_VIRTIO_IOMMU_PCI, .instance_size = sizeof(VirtIOIOMMUPCI), .instance_init = virtio_iommu_pci_instance_init, + .instance_finalize = virtio_iommu_pci_instance_finalize, .class_init = virtio_iommu_pci_class_init, };