linux-stable/drivers/soundwire
Krzysztof Kozlowski e199bf52ff soundwire: stream: fix NULL pointer dereference for multi_link
If bus is marked as multi_link, but number of masters in the stream is
not higher than bus->hw_sync_min_links (bus->multi_link && m_rt_count >=
bus->hw_sync_min_links), bank switching should not happen.  The first
part of do_bank_switch() code properly takes these conditions into
account, but second part (sdw_ml_sync_bank_switch()) relies purely on
bus->multi_link property.  This is not balanced and leads to NULL
pointer dereference:

  Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
  ...
  Call trace:
   wait_for_completion_timeout+0x124/0x1f0
   do_bank_switch+0x370/0x6f8
   sdw_prepare_stream+0x2d0/0x438
   qcom_snd_sdw_prepare+0xa0/0x118
   sm8450_snd_prepare+0x128/0x148
   snd_soc_link_prepare+0x5c/0xe8
   __soc_pcm_prepare+0x28/0x1ec
   dpcm_be_dai_prepare+0x1e0/0x2c0
   dpcm_fe_dai_prepare+0x108/0x28c
   snd_pcm_do_prepare+0x44/0x68
   snd_pcm_action_single+0x54/0xc0
   snd_pcm_action_nonatomic+0xe4/0xec
   snd_pcm_prepare+0xc4/0x114
   snd_pcm_common_ioctl+0x1154/0x1cc0
   snd_pcm_ioctl+0x54/0x74

Fixes: ce6e74d008 ("soundwire: Add support for multi link bank switch")
Cc: stable@vger.kernel.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20231124180136.390621-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-11-28 12:28:16 +05:30
..
amd_manager.c soundwire: amd: Fix a check for errors in probe() 2023-07-13 11:09:07 +05:30
amd_manager.h soundwire: amd: handle SoundWire wake enable interrupt 2023-04-12 15:30:36 +05:30
bus.c soundwire updates for 6.7 2023-11-03 19:10:41 -10:00
bus.h soundwire: export sdw_compute_slave_ports() function 2023-04-12 15:30:35 +05:30
bus_type.c soundwire: bus: Make IRQ handling conditionally built 2023-09-21 11:31:33 +02:00
cadence_master.c soundwire: cadence: revisit parity injection 2023-05-29 10:49:47 +05:30
cadence_master.h soundwire: intel/cadence: update hardware reset sequence 2023-05-29 10:49:47 +05:30
debugfs.c soundwire: debugfs: Add missing SCP registers 2023-06-08 17:10:32 +05:30
dmi-quirks.c soundwire: dmi-quirks: update HP Omen match 2023-10-16 16:48:05 +05:30
generic_bandwidth_allocation.c soundwire: bandwidth allocation: Remove pointless variable 2023-06-08 17:09:11 +05:30
intel.c ASoC: soundwire: convert not to use asoc_xxx() 2023-09-25 14:16:40 +02:00
intel.h soundwire: intel_ace2x: add debugfs support 2023-05-27 16:06:45 +05:30
intel_ace2x.c ASoC: soundwire: convert not to use asoc_xxx() 2023-09-25 14:16:40 +02:00
intel_ace2x_debugfs.c soundwire: intel_ace2x: add debugfs support 2023-05-27 16:06:45 +05:30
intel_auxdevice.c soundwire: intel_auxdevice: add hybrid IDA-based device_number allocation 2023-08-11 07:59:25 +01:00
intel_auxdevice.h soundwire: intel: split auxdevice to different file 2022-11-23 20:11:49 +05:30
intel_bus_common.c soundwire: intel/cadence: update hardware reset sequence 2023-05-29 10:49:47 +05:30
intel_init.c soundwire: intel_init: use eml_lock parameter 2023-05-27 16:06:45 +05:30
irq.c soundwire: bus: Make IRQ handling conditionally built 2023-09-21 11:31:33 +02:00
irq.h soundwire: bus: Make IRQ handling conditionally built 2023-09-21 11:31:33 +02:00
Kconfig soundwire: intel_ace2x: fix SND_SOC_SOF_HDA_MLINK dependency 2023-06-21 16:19:44 +05:30
Makefile soundwire: bus: Make IRQ handling conditionally built 2023-09-21 11:31:33 +02:00
master.c soundwire: master: use pm_runtime_set_active() on add 2020-12-02 12:49:34 +05:30
mipi_disco.c soundwire: fix port_ready[] dynamic allocation in mipi_disco 2020-09-03 16:02:29 +05:30
qcom.c soundwire: qcom: Log clk_get("iface") failures 2023-09-21 11:33:40 +02:00
slave.c Char / Misc driver changes for 6.0-rc1 2022-08-04 11:05:48 -07:00
stream.c soundwire: stream: fix NULL pointer dereference for multi_link 2023-11-28 12:28:16 +05:30
sysfs_local.h soundwire: sysfs: add slave status and device number before probe 2020-09-28 11:17:43 +05:30
sysfs_slave.c soundwire: sysfs: Constify static struct attribute_group 2021-01-19 20:21:20 +05:30
sysfs_slave_dpn.c soundwire: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute 2020-11-24 14:08:51 +05:30