mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: Malaya Kumar Rout <mrout@redhat.com>
Cc: malayarout91@gmail.com, platform-driver-x86@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tools/power/x86/intel-speed-select: Fix file descriptor leak in isolate_cpus()
Date: Fri, 16 Jan 2026 15:43:13 -0800	[thread overview]
Message-ID: <adc80024f2754bc409bc0994e436dc0ffe18c9f5.camel@linux.intel.com> (raw)
In-Reply-To: <20260115100333.171244-1-mrout@redhat.com>

On Thu, 2026-01-15 at 15:33 +0530, Malaya Kumar Rout wrote:
> 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")

Thanks for the change. Will include in the next pull request.

-Srinivas

> Signed-off-by: Malaya Kumar Rout <mrout@redhat.com>
> ---
>  tools/power/x86/intel-speed-select/isst-config.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/power/x86/intel-speed-select/isst-config.c
> b/tools/power/x86/intel-speed-select/isst-config.c
> index 558138eea75e..d00d15490a98 100644
> --- a/tools/power/x86/intel-speed-select/isst-config.c
> +++ b/tools/power/x86/intel-speed-select/isst-config.c
> @@ -950,9 +950,11 @@ int isolate_cpus(struct isst_id *id, int
> mask_size, cpu_set_t *cpu_mask, int lev
>  		ret = write(fd, "member", strlen("member"));
>  		if (ret == -1) {
>  			printf("Can't update to member\n");
> +			close(fd);
>  			return ret;
>  		}
>  
> +		close(fd);
>  		return 0;
>  	}
>  

      reply	other threads:[~2026-01-16 23:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15 10:03 Malaya Kumar Rout
2026-01-16 23:43 ` srinivas pandruvada [this message]

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=adc80024f2754bc409bc0994e436dc0ffe18c9f5.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=malayarout91@gmail.com \
    --cc=mrout@redhat.com \
    --cc=platform-driver-x86@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

all inboxes | Powered by JetHome®