]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tools/power turbostat: Set per_cpu_msr_sum to NULL after free
authorEmily Ehlert <ehemily@amazon.com>
Thu, 13 Nov 2025 19:16:08 +0000 (19:16 +0000)
committerLen Brown <len.brown@intel.com>
Tue, 2 Dec 2025 20:58:30 +0000 (15:58 -0500)
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>
Signed-off-by: Len Brown <len.brown@intel.com>
tools/power/x86/turbostat/turbostat.c

index 2854b66eb74809bc15aa9fbf679e6ab899547d31..8154d110dd07d81001bbd444490d9b39e1877fba 100644 (file)
@@ -6652,6 +6652,7 @@ release_timer:
        timer_delete(timerid);
 release_msr:
        free(per_cpu_msr_sum);
+       per_cpu_msr_sum = NULL;
 }
 
 /*