Linux Power Management development
 help / color / mirror / Atom feed
From: Lukas Beckmann <lbckmnn@mailbox.org>
To: Shuah Khan <skhan@linuxfoundation.org>
Cc: Thomas Renninger <trenn@suse.com>, Shuah Khan <shuah@kernel.org>,
	"John B. Wyatt IV" <jwyatt@redhat.com>,
	John Kacur <jkacur@redhat.com>,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] cpupower: fix use-after-free and stale limits in frequency-set
Date: Tue, 17 Nov 2026 17:11:47 +0100	[thread overview]
Message-ID: <avx8wwQBBu5n8z9f@lukas-arch> (raw)
In-Reply-To: <94e8f3c9-5162-4717-8063-f5c2b4828456@linuxfoundation.org>

On Mon, Nov 16, 2026 at 04:30:10PM -0700, Shuah Khan wrote:
> On 11/15/26 03:03, Lukas Beckmann wrote:
> > @@ -141,9 +141,10 @@ static unsigned long string_to_frequency(const char *str)
> >   	}
> >   }
> > -static int do_new_policy(unsigned int cpu, struct cpufreq_policy *new_pol)
> > +static int do_new_policy(unsigned int cpu, const struct cpufreq_policy *new_pol)
> >   {
> >   	struct cpufreq_policy *cur_pol = cpufreq_get_policy(cpu);
> > +	struct cpufreq_policy temp_pol;
> >   	int ret;
> >   	if (!cur_pol) {
> > @@ -151,16 +152,22 @@ static int do_new_policy(unsigned int cpu, struct cpufreq_policy *new_pol)
> >   		return -EINVAL;
> >   	}
> > -	if (!new_pol->min)
> > -		new_pol->min = cur_pol->min;
> 
> Why can't you leave this logic as is and set temp_pol fieds,
>  if (!new_pol->min)
> 	temp_pol = cur_pol->min;
>  else
> 	temp_pol.min = new_pol->min;
[...]
> 
> Same for all of the above. Make just the minimum changes
> to fix the problem instead of changing the logic
> 

I did it this way because I found it easier to read. I will keep the
original conditions in V3 to keep the diff smaller.

Thanks,
Lukas

      reply	other threads:[~2026-11-17 16:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15 10:03 [PATCH v2] cpupower: fix use-after-free and stale limits in frequency-set Lukas Beckmann
2026-11-16 23:30 ` Shuah Khan
2026-11-17 16:11   ` Lukas Beckmann [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=avx8wwQBBu5n8z9f@lukas-arch \
    --to=lbckmnn@mailbox.org \
    --cc=jkacur@redhat.com \
    --cc=jwyatt@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=stable@vger.kernel.org \
    --cc=trenn@suse.com \
    /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