linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Emily Ehlert <ehemily@amazon.de>
To: <lenb@kernel.org>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Emily Ehlert <ehemily@amazon.com>
Subject: [PATCH 1/2] tools/power/turbostat: Set per_cpu_msr_sum to NULL after free
Date: Thu, 13 Nov 2025 19:16:08 +0000	[thread overview]
Message-ID: <20251113191609.28574-1-ehemily@amazon.de> (raw)

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


             reply	other threads:[~2025-11-13 19:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-13 19:16 Emily Ehlert [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251113191609.28574-1-ehemily@amazon.de \
    --to=ehemily@amazon.de \
    --cc=ehemily@amazon.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).