From nobody Sun Apr 28 14:40:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1566295808; cv=none; d=zoho.com; s=zohoarc; b=kwYuniMKsbCrvBWu86YskWtYCAYiIv0tPs6tLCL+ZF6qB8f1vrqH733uehTXg/qN1xlMS3bu1H6RlEEr7QsKj726Xw0Fk2FICkNperm7PIWaGcxD7VDAG40WIvX1p4a9tud07+6aJCT1Yuko1XZ4lhLMjvyl87rxCQNxNN1xTPo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566295808; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=aCxNrDxiu05wlsCM8X9Hao5+bQ5tI8q4HRYViAN9YsQ=; b=klgl82lOU5joimv2QnPYvdZcDK5+ZSplm+Jv879wV1IUg89KhmuGpld/4ykFfd71UqiLhiq8pjpOdGgwWLJGMbqPBMgtmXB3vdnpUTpYMRzX7cgpwhCUoY9JmII0YIjcpbraQqJrInEDsBde01m6nu8Ww0Ci+uErdx3W/XZyIOQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1566295808052408.2483900130794; Tue, 20 Aug 2019 03:10:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E1C1F305B39C; Tue, 20 Aug 2019 10:10:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8DCC15C205; Tue, 20 Aug 2019 10:10:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CF1C8180B536; Tue, 20 Aug 2019 10:09:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7KA9rIf016315 for ; Tue, 20 Aug 2019 06:09:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3504950; Tue, 20 Aug 2019 10:09:53 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F4056092F; Tue, 20 Aug 2019 10:09:50 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 847D23086E23; Tue, 20 Aug 2019 10:09:48 +0000 (UTC) Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Aug 2019 03:09:47 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga008.fm.intel.com with ESMTP; 20 Aug 2019 03:09:46 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,408,1559545200"; d="scan'208";a="178143783" From: Wang Huaqiang To: libvir-list@redhat.com Date: Tue, 20 Aug 2019 18:06:03 +0800 Message-Id: <1566295563-13485-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 20 Aug 2019 10:09:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 20 Aug 2019 10:09:49 +0000 (UTC) for IP:'134.134.136.126' DOMAIN:'mga18.intel.com' HELO:'mga18.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED, SPF_HELO_NONE, SPF_PASS) 134.134.136.126 mga18.intel.com 134.134.136.126 mga18.intel.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, tao.su@intel.com, huaqiang.wang@intel.com Subject: [libvirt] [PATCH] conf: resctrl object is not properly handled X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 20 Aug 2019 10:10:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" resctrl object stored in def->resctrls is shared by cachetune and memorytune. The domain xml configuration is parsed firstly for cachetune then memorytune, and the resctrl object will not be created in parsing settings for memorytune once it found sharing exists. But resctrl is improperly freed when sharing happens. Signed-off-by: Wang Huaqiang Reviewed-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 12 +++++------- tests/genericxml2xmlindata/memorytune.xml | 4 ++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 617ccac..604e006 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19590,7 +19590,6 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, VIR_AUTOUNREF(virResctrlAllocPtr) alloc =3D NULL; ssize_t i =3D 0; int n; - int ret =3D -1; =20 ctxt->node =3D node; =20 @@ -19632,14 +19631,13 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, if (!(resctrl =3D virDomainResctrlNew(node, alloc, vcpus, flags))) return -1; =20 - if (VIR_APPEND_ELEMENT(def->resctrls, def->nresctrls, resctrl) < 0) - goto cleanup; + if (VIR_APPEND_ELEMENT(def->resctrls, def->nresctrls, resctrl) < 0= ) { + virDomainResctrlDefFree(resctrl); + return -1; + } } =20 - ret =3D 0; - cleanup: - virDomainResctrlDefFree(resctrl); - return ret; + return 0; } =20 =20 diff --git a/tests/genericxml2xmlindata/memorytune.xml b/tests/genericxml2x= mlindata/memorytune.xml index ea03e22..7486b54 100644 --- a/tests/genericxml2xmlindata/memorytune.xml +++ b/tests/genericxml2xmlindata/memorytune.xml @@ -5,6 +5,10 @@ 219136 4 + + + + --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list