Re: [PATCH v2 01/10] soundwire: bus: Hold bus_lock when looking up slave devices
From: Charles Keepax
Date: Fri Nov 13 2026 - 14:56:06 EST
On Tue, Nov 03, 2026 at 09:53:45AM +0000, Lee Jones wrote:
> sdw_get_slave() iterates over bus->slaves and requires bus->bus_lock to
> be held by the caller. However, sdw_handle_slave_status() and
> sdw_clear_slave_status() drop bus->bus_lock immediately before calling
> sdw_get_slave(). If a concurrent slave teardown unlinks the node via
> list_del_init() and frees the slave while bus->bus_lock is dropped,
> sdw_get_slave() can spin forever on the self-referential list entry or
> dereference freed memory.
>
> Keep bus->bus_lock held across the sdw_get_slave() lookup in
> sdw_handle_slave_status() and sdw_clear_slave_status().
>
> Closes: https://sashiko.dev/#/bug/linux-b0e65a93-dfd4-4e3d-a96c-8f13ba0aafd2
> Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
> ---
Reviewed-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
Tested-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
Thanks,
Charles