Re: [PATCH 4/4] platform/x86: wmi: Fix notify callback locking

From: Ilpo Järvinen
Date: Thu Jan 04 2024 - 13:16:12 EST


On Wed, 3 Jan 2024, Armin Wolf wrote:

> When an legacy WMI event handler is removed, an WMI event could
> have called the handler just before it was removed, meaning the
> handler could still be running after wmi_remove_notify_handler()
> returns.
> Something similar could also happens when using the WMI bus, as
> the WMI core might still call the notify() callback from an WMI
> driver even if its remove() callback was just called.
>
> Fix this by introducing a rw semaphore which ensures that the
> event state of a WMI device does not change while the WMI core
> is handling an event for it.
>
> Tested on a Dell Inspiron 3505 and a Acer Aspire E1-731.
>
> Fixes: 1686f5444546 ("platform/x86: wmi: Incorporate acpi_install_notify_handler")
> Signed-off-by: Armin Wolf <W_Armin@xxxxxx>

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>

--
i.