[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250416073420.xrhwnzy22zf6yltm@vireshk-i7>
Date: Wed, 16 Apr 2025 13:04:20 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: rafael@...nel.org, Marc Zyngier <maz@...nel.org>
Cc: Chenyuan Yang <chenyuan0y@...il.com>, sven@...npeter.dev, j@...nau.net,
alyssa@...enzweig.io, neal@...pa.dev, marcan@...can.st,
asahi@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cpufreq: apple-soc: Fix possible null pointer dereference
On 13-04-25, 11:02, Marc Zyngier wrote:
> Irrespective of this, it would be good to describe under which
> circumstances this can occur, because I can't see *how* this can
> trigger. The policy is directly provided by the core code and provide
> its association with a cpu, and is never NULL at the point of init.
>
> And if it can trigger, why only fix this one particular case?
> Dereferences of policy are all over the map, and would be just as
> wrong.
>
> So while this is not wrong, I don't think this serves any real
> purpose.
I have applied such patches in the past, considering the same as good
practice. But I do understand your inputs.
And so I tried to see if there is actually a way to trigger this.
- Platform with two cpufreq policies (freq domains) with one CPU in
each of them.
- Boot the kernel, policies will initialize for both the domains.
- Hotplug out CPU1, that will remove the policy as well.
- Call cpufreq_quick_get(1), this will call the ->get() callback for
CPU1, for which there is no policy available.
But this is the case only for drivers with `setpolicy` callback, this
shouldn't happen on apple-soc.
I am not sure now if we should just apply this patch to be safe, or
leave it as is. The cpufreq core may change in the future and call the
`get` callback for all drivers.
Rafael, what do you suggest ?
--
viresh
Powered by blists - more mailing lists