linux/tools/power
Malaya Kumar Rout 71b23ada25 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-02-26 14:59:25 -08:00
..
acpi ACPICA: acpidump: fix return values in ap_is_valid_checksum() 2025-09-15 12:20:13 +02:00
cpupower Kbuild updates for 6.18 2025-10-01 20:58:51 -07:00
pm-graph PM: sleep: Use two lines for "Restarting..." / "done" messages 2025-04-22 13:58:30 +02:00
x86 tools/power/x86/intel-speed-select: Fix file descriptor leak in isolate_cpus() 2026-02-26 14:59:25 -08:00