From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 24585A0A0C; Wed, 7 Apr 2021 17:56:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C9150140F69; Wed, 7 Apr 2021 17:56:51 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id DB317140F3C for ; Wed, 7 Apr 2021 17:56:50 +0200 (CEST) IronPort-SDR: k5MnJSl5hhb5UBe6CBH2Cqd5NKtyM6pvRROGKFskpjKxPnYxfZ6T6XvqfO4xXEvRjwFesfOvJN Z4c2Hv4eZAOw== X-IronPort-AV: E=McAfee;i="6000,8403,9947"; a="172813461" X-IronPort-AV: E=Sophos;i="5.82,203,1613462400"; d="scan'208";a="172813461" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2021 08:56:49 -0700 IronPort-SDR: y4H7sN1LRy8zTQZNb3y7M8F/SaCmwyqwrwDLO3TwvusXL15YAlGUm0exp44xCChGXxzwwE6GmK DGkDDl8kfKWw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,203,1613462400"; d="scan'208";a="530254117" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.222.97]) by orsmga004.jf.intel.com with ESMTP; 07 Apr 2021 08:56:46 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: david.hunt@intel.com, thomas@monjalon.net Date: Wed, 7 Apr 2021 15:56:42 +0000 Message-Id: <20210407155642.435964-1-anatoly.burakov@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] power: fix use-after-free in pstate code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Previous fix has addressed the incorrect handling of `base_frequency` file, but has added a use-after-free error due to the fact that all further code paths will lead to an `fclose()` call at the end, so the additional `fclose()` call right after processing the file was unnecessary. Coverity issue: 369901 Fixes: 8a5febaac4f7 ("power: fix P-state base frequency handling") Signed-off-by: Anatoly Burakov --- lib/librte_power/power_pstate_cpufreq.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/librte_power/power_pstate_cpufreq.c b/lib/librte_power/power_pstate_cpufreq.c index 1cb0e4d917..ec745153d3 100644 --- a/lib/librte_power/power_pstate_cpufreq.c +++ b/lib/librte_power/power_pstate_cpufreq.c @@ -220,7 +220,6 @@ power_init_for_setting_freq(struct pstate_power_info *pi) base_ratio = strtoul(buf_base, NULL, POWER_CONVERT_TO_DECIMAL) / BUS_FREQ; - fclose(f_base); } /* Add MSR read to detect turbo status */ -- 2.25.1