[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025091322-resilient-bottle-6d85@gregkh>
Date: Sat, 13 Sep 2025 09:33:36 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: GuangFei Luo <luogf2025@....com>
Cc: rafael@...nel.org, dan.carpenter@...aro.org, lenb@...nel.org,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org, lkp@...el.com, sre@...nel.org,
stable@...r.kernel.org
Subject: Re: [PATCH v4] ACPI: battery: prevent sysfs_add_battery re-entry on
rapid events
On Sat, Sep 13, 2025 at 03:19:25PM +0800, GuangFei Luo wrote:
> v4:
> - Uses guard(mutex) for battery->sysfs_lock in sysfs_add_battery().
> - Since sysfs_add_battery() now handles the battery->bat check with
> proper locking,the extra if (!battery->bat) check at the call site
> has become redundant.
>
> v3:
> - Modified the earlier approach: since sysfs_add_battery() is invoked
> from multiple places, the most reliable way is to add the lock inside
> the function itself.
> - sysfs_remove_battery() had a similar race issue in the past, which was
> fixed by adding a lock as well. Reference:
> https://lore.kernel.org/all/9c921c22a7f33397a6774d7fa076db9b6a0fd669
> .1312318300.git.len.brown@...el.com/
>
> v2:
> - Fix missing mutex_unlock in acpi_battery_update()
> (Reported-by: kernel test robot)
>
> v1:
> When removing and reinserting the laptop battery, ACPI can trigger
> two notifications in quick succession:
Again, all of this goes below the --- line, not above it.
Powered by blists - more mailing lists