Re: [PATCH RESEND v3 2/3] ACPI: battery: Fix possible crash when unregistering a battery hook

From: Rafael J. Wysocki
Date: Wed Oct 02 2024 - 13:54:55 EST


On Wed, Oct 2, 2024 at 2:54 PM Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote:
>
> On Wed, Oct 2, 2024 at 2:35 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
> >
> > Hi,
> >
> > On 2-Oct-24 2:08 PM, Rafael J. Wysocki wrote:
> > > On Tue, Oct 1, 2024 at 11:28 PM Armin Wolf <W_Armin@xxxxxx> wrote:
> > >>
> > >> When a battery hook returns an error when adding a new battery, then
> > >> the battery hook is automatically unregistered.
> > >> However the battery hook provider cannot know that, so it will later
> > >> call battery_hook_unregister() on the already unregistered battery
> > >> hook, resulting in a crash.
> > >>
> > >> Fix this by using the list head to mark already unregistered battery
> > >> hooks as already being unregistered so that they can be ignored by
> > >> battery_hook_unregister().
> > >>
> > >> Fixes: fa93854f7a7e ("battery: Add the battery hooking API")
> > >> Signed-off-by: Armin Wolf <W_Armin@xxxxxx>
> > >
> > > Acked-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> > >
> > > Hans, are you going to take this series or should I apply it?
> >
> > AFAICT the patches don't really depend on each other,
>
> OK
>
> > so my plan was that you take patches 1-2 and I take patch 3 as a fix for
> > 6.12-rc# .
> >
> > Does that work for you ?
>
> Yes, it does, thanks!

Now queued up for 6.12-rc along with the [1/3], thanks!