Re: [PATCH RESEND] powercap: intel_rapl: Fix kernel panic during PMU unbind
"Rafael J. Wysocki (Intel)" <[email protected]>
| Newsgroups | org.kernel.vger.linux-pm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAJZ5v0hpaccbRZLJ+Y5Xo-3c9ynagPfwuJ2UvMcKARZv-AGYXA@mail.gmail.com> |
On Mon, Aug 24, 2026 at 9:35 AM Abel Vesa <[email protected]> wrote: > > On 26-08-22 15:16:57, Sumeet Pawnikar wrote: > > From: Sumeet Pawnikar <[email protected]> > > > > rapl_package_add_pmu() fails internally at perf_pmu_register(), > > and rapl_pmu_update() leaves the global rapl_pmu.pmu structure > > zero-initialized via memset and returns an error. But any > > previously probed packages retain has_pmu = true. > > > > When the driver is subsequently unbound or removed, > > rapl_package_remove_pmu_locked() sees has_pmu == true and > > unconditionally calls perf_pmu_unregister(&rapl_pmu.pmu) on the > > zeroed-out structure. This attempts a list_del_rcu() on a NULL > > list head, immediately causing a kernel panic. > > > > Fix this by checking if the PMU is actually registered before > > attempting to unregister it. > > > > Signed-off-by: Sumeet Pawnikar <[email protected]> > > Looks OK to me, so: > > Reviewed-by: Abel Vesa <[email protected]> Applied as 7.3-rc material, thanks!