Skip to contentSkip to conversation

power: fix resource leak by open file pointers

PATCH Applied Tadhg Kearney 4 participants 6 messages Oct 12, 2022 – Nov 14, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: fix resource leak by open file pointers

Close file pointers to Intel uncore sysfiles.

Coverity issue: 381400 381397

Fixes 60b8a661a957 ("power: add Intel uncore frequency control")
---
 lib/power/rte_power_intel_uncore.c | 5 +++++
 1 file changed, 5 insertions(+)
lib/power/rte_power_intel_uncore.c +5 -0
index 3afe8feffa..f86e1c8b7a 100644
@@ -192,6 +192,11 @@ power_init_for_setting_uncore_freq(struct uncore_power_info *ui)
 	ui->init_max_freq = base_max_freq;
 	ui->init_min_freq = base_min_freq;
 
+	fclose(f_base_min);
+	fclose(f_base_max);
+	fclose(f_max);
+	fclose(f_min);
+
 	return 0;
 
 err:
Signature · 1 line
2.25.1
Reviewed-by Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Kearney, Tadhg <[email protected]>
Sent: Wednesday, October 12, 2022 9:29 AM
To: [email protected]
Cc: Hunt, David <[email protected]>; Burakov, Anatoly <[email protected]>; Pattan, Reshma <[email protected]>; Kearney, Tadhg <[email protected]>
Subject: [PATCH] power: fix resource leak by open file pointers

Quoted 7 lines

Close file pointers to Intel uncore sysfiles.

Coverity issue: 381400 381397

Fixes 60b8a661a957 ("power: add Intel uncore frequency control")
#3 lore raw

PATCH 1/1 power: fix double free of opened files

In reply to Tadhg Kearney

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")
---
 lib/power/rte_power_intel_uncore.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/power/rte_power_intel_uncore.c +1 -2
index f86e1c8b7a..3b8724385f 100644
@@ -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;
 
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#4 lore raw

RE: [PATCH] power: fix double free of opened files

Quoted 4 lines

-----Original Message-----
From: Kearney, Tadhg <[email protected]>

<snip>

Quoted 10 lines

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")

---

#5 lore raw

Re: [PATCH] power: fix double free of opened files

Quoted 5 lines · Reshma
Quoted 5 lines

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'"

Quoted 5 lines
Quoted 3 lines

---

Applied, thanks.

Signature · 1 line
David Marchand