power: fix double free of opened files

Message ID 20221104162353.187145-1-tadhg.kearney@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series power: fix double free of opened files |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed

Commit Message

Tadhg Kearney Nov. 4, 2022, 4:23 p.m. UTC
  Fix double free of f_min and f_max by reverting the flcose() for f_min
and f_max. As f_min and f_max are stored for further use and closed in
uncore deinitialization.

Fixes: b127e74 ("power: fix open file descriptors leak")

Signed-off-by: Tadhg Kearney <tadhg.kearney@intel.com>
---
 lib/power/rte_power_intel_uncore.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Pattan, Reshma Nov. 7, 2022, 9:17 a.m. UTC | #1
> -----Original Message-----
> From: Kearney, Tadhg <tadhg.kearney@intel.com>
<snip>
> Subject: [PATCH] power: fix double free of opened files
> 
> Fix double free of f_min and f_max by reverting the flcose() for f_min and
> f_max. As f_min and f_max are stored for further use and closed in uncore
> deinitialization.
> 
> Fixes: b127e74 ("power: fix open file descriptors leak")
> 
> Signed-off-by: Tadhg Kearney <tadhg.kearney@intel.com>
> ---

Acked-by: Reshma Pattan <reshma.pattan@intel.com>
  
David Marchand Nov. 14, 2022, 10 a.m. UTC | #2
On Mon, Nov 7, 2022 at 10:18 AM Pattan, Reshma <reshma.pattan@intel.com> wrote:
> > Fix double free of f_min and f_max by reverting the flcose() for f_min and
> > f_max. As f_min and f_max are stored for further use and closed in uncore
> > deinitialization.
> >
> > Fixes: b127e74 ("power: fix open file descriptors leak")

Please, use 12 chars format for commit hash, as documented.
git config alias.fixline "log -1 --abbrev=12 --format='Fixes: %h
(\"%s\")%nCc: %ae'"


> >
> > Signed-off-by: Tadhg Kearney <tadhg.kearney@intel.com>
> > ---
>
> Acked-by: Reshma Pattan <reshma.pattan@intel.com>

Applied, thanks.
  

Patch

diff --git a/lib/power/rte_power_intel_uncore.c b/lib/power/rte_power_intel_uncore.c
index f86e1c8b7a..3b8724385f 100644
--- a/lib/power/rte_power_intel_uncore.c
+++ b/lib/power/rte_power_intel_uncore.c
@@ -194,8 +194,7 @@  power_init_for_setting_uncore_freq(struct uncore_power_info *ui)
 
 	fclose(f_base_min);
 	fclose(f_base_max);
-	fclose(f_max);
-	fclose(f_min);
+	/* f_min and f_max are stored, no need to close */
 
 	return 0;