Re: [PATCH] opp: Fix use-after-free in lazy_opp_tables after probe deferral

From: Viresh Kumar
Date: Tue May 30 2023 - 05:13:38 EST


On 30-05-23, 10:31, Stephan Gerhold wrote:
> Thanks, this seems to fix the crash as well. Are you going to handle it
> or should I send a v2 with this diff?

Please send a V2 :)

> During _allocate_opp_table() it's accessed without the opp_table_lock,
> because of
>
> /* Drop the lock to reduce the size of critical section */
> mutex_unlock(&opp_table_lock);
>
> if (opp_table) {
> /* ... */
> mutex_lock(&opp_table_lock);
> } else {
> opp_table = _allocate_opp_table(dev, index);
>
> mutex_lock(&opp_table_lock);
> /* ... */
> }
>
> This doesn't seem to cause any problems in my case though so it's
> unrelated to the crash I observed.

Hmm, right. Maybe we need a lock for that list, want to take that up ?

--
viresh