]> git.ipfire.org Git - thirdparty/linux.git/commit
tools/power/x86/intel-speed-select: Fix file descriptor leak in isolate_cpus()
authorMalaya Kumar Rout <mrout@redhat.com>
Thu, 15 Jan 2026 10:03:33 +0000 (15:33 +0530)
committerSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Sat, 17 Jan 2026 00:03:21 +0000 (16:03 -0800)
commit56c17ee151c6e1a73d77e15b82a8e2130cd8dd16
treeb9b0aadb299134900c4f897c36cee0819d642efd
parent21adcd5ec99f342489a49e9d237a987b1bd9fab5
tools/power/x86/intel-speed-select: Fix file descriptor leak in isolate_cpus()

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: 997074df658e ("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>
tools/power/x86/intel-speed-select/isst-config.c