linux/tools/power/x86
Malaya Kumar Rout f143ea1ff6 tools/power/x86/intel-speed-select: Fix file descriptor leak in isolate_cpus()
[ Upstream commit 56c17ee151 ]

The file descriptor opened in isolate_cpus() when (!level) is true was
not being closed before returning, causing a file descriptor leak in
both the error path and the success path.

When write() fails at line 950, the function returns at line 953 without
closing the file descriptor. Similarly, on success, the function returns
at line 956 without closing the file descriptor.

Add close(fd) calls before both return statements to fix the resource
leak. This follows the same pattern used elsewhere in the same function
where file descriptors are properly closed before returning (see lines
1005 and 1027).

Fixes: 997074df65 ("tools/power/x86/intel-speed-select: Use cgroup v2 isolation")
Signed-off-by: Malaya Kumar Rout <mrout@redhat.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-03-04 07:20:18 -05:00
..
amd_pstate_tracer selftests/amd-pstate: Fix broken paths to run workloads in amd-pstate-ut 2023-10-16 13:06:50 -06:00
intel-speed-select tools/power/x86/intel-speed-select: Fix file descriptor leak in isolate_cpus() 2026-03-04 07:20:18 -05:00
intel_pstate_tracer tools/power/x86/intel_pstate_tracer: python minimum version 2023-09-21 20:35:50 +02:00
turbostat tools/power turbostat: fix GCC9 build regression 2026-02-11 13:40:17 +01:00
x86_energy_perf_policy tools/power x86_energy_perf_policy: Prefer driver HWP limits 2025-11-13 15:34:08 -05:00