Re: [PATCH] OPP: Fix cleanup ordering
From: Viresh Kumar
Date: Wed Jul 15 2026 - 04:28:32 EST
On 15-07-26, 09:35, Gregor Herburger wrote:
> Commit 173e02d67494 ("OPP: Initialize scope-based pointers inline")
> added initialization for all pointers. In some cases, the ordering was
> changed so that *opp_table was initialized after *opp. This also changes
> the order of the registered cleanup functions.
>
> When the cleanup happens, this can cause use-after-free errors when the
> last reference is released and the release function _opp_kref_release
> tries to access the already freed opp->opp_table.
>
> Initialize *opp_table before *opp again to fix this and ensure the
> correct cleanup order.
>
> Fixes: 173e02d67494 ("OPP: Initialize scope-based pointers inline")
> Signed-off-by: Gregor Herburger <gregor.herburger@xxxxxxxxxxxxx>
> ---
> drivers/opp/core.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
Applied. Thanks.
--
viresh