linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] tools/power/turbostat: Set per_cpu_msr_sum to NULL after free
@ 2025-11-13 19:16 Emily Ehlert
  2025-11-13 19:16 ` [PATCH 2/2] tools/power/turbostat: Fix division by zero when TDP calculation fails Emily Ehlert
  2025-11-25 18:06 ` [PATCH 1/2] tools/power/turbostat: Set per_cpu_msr_sum to NULL after free Len Brown
  0 siblings, 2 replies; 11+ messages in thread
From: Emily Ehlert @ 2025-11-13 19:16 UTC (permalink / raw)
  To: lenb; +Cc: linux-pm, linux-kernel, Emily Ehlert

From: Emily Ehlert <ehemily@amazon.com>

Set per_cpu_msr_sum to NULL after freeing it in the error path
of msr_sum_record() to prevent potential use-after-free issues.

Signed-off-by: Emily Ehlert <ehemily@amazon.com>
---
 tools/power/x86/turbostat/turbostat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 72a280e7a9d5..9a2be201a3a6 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -6673,6 +6673,7 @@ void msr_sum_record(void)
 	timer_delete(timerid);
 release_msr:
 	free(per_cpu_msr_sum);
+	per_cpu_msr_sum = NULL;
 }
 
 /*
-- 
2.47.3




Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Christof Hellmis
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-12-02 16:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-13 19:16 [PATCH 1/2] tools/power/turbostat: Set per_cpu_msr_sum to NULL after free Emily Ehlert
2025-11-13 19:16 ` [PATCH 2/2] tools/power/turbostat: Fix division by zero when TDP calculation fails Emily Ehlert
2025-11-25 18:13   ` Len Brown
2025-11-28 13:59     ` Ehlert, Emily
2025-11-30  5:27       ` Len Brown
2025-12-01  8:55         ` Ehlert, Emily
2025-12-01 17:07           ` Len Brown
2025-12-01 19:14             ` Len Brown
2025-12-02  9:09               ` Ehlert, Emily
2025-12-02 16:20                 ` Len Brown
2025-11-25 18:06 ` [PATCH 1/2] tools/power/turbostat: Set per_cpu_msr_sum to NULL after free Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).