linux-stable/drivers/soundwire
Johan Hovold a36b522767 soundwire: fix enumeration completion
[ Upstream commit c40d6b3249 ]

The soundwire subsystem uses two completion structures that allow
drivers to wait for soundwire device to become enumerated on the bus and
initialised by their drivers, respectively.

The code implementing the signalling is currently broken as it does not
signal all current and future waiters and also uses the wrong
reinitialisation function, which can potentially lead to memory
corruption if there are still waiters on the queue.

Not signalling future waiters specifically breaks sound card probe
deferrals as codec drivers can not tell that the soundwire device is
already attached when being reprobed. Some codec runtime PM
implementations suffer from similar problems as waiting for enumeration
during resume can also timeout despite the device already having been
enumerated.

Fixes: fb9469e54f ("soundwire: bus: fix race condition with enumeration_complete signaling")
Fixes: a90def0681 ("soundwire: bus: fix race condition with initialization_complete signaling")
Cc: stable@vger.kernel.org      # 5.7
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230705123018.30903-2-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-08-11 15:14:00 +02:00
..
bus.c soundwire: fix enumeration completion 2023-08-11 15:14:00 +02:00
bus.h
bus_type.c soundwire: bus_type: Avoid lockdep assert in sdw_drv_probe() 2023-03-11 13:57:35 +01:00
cadence_master.c soundwire: cadence: Drain the RX FIFO after an IO timeout 2023-03-11 13:57:39 +01:00
cadence_master.h soundwire: cadence: Remove wasted space in response_buf 2023-03-11 13:57:39 +01:00
debugfs.c
dmi-quirks.c soundwire: dmi-quirks: add new mapping for HP Spectre x360 2023-06-28 10:29:52 +02:00
generic_bandwidth_allocation.c
intel.c
intel.h
intel_init.c
Kconfig
Makefile
master.c
mipi_disco.c
qcom.c soundwire: qcom: update status correctly with mask 2023-08-03 10:22:33 +02:00
slave.c
stream.c
sysfs_local.h
sysfs_slave.c
sysfs_slave_dpn.c