kernel_samsung_a53x/sound/soc
robelin 576e67c5cf ASoC: dapm: Fix UAF for snd_soc_pcm_runtime object
commit b4a90b543d9f62d3ac34ec1ab97fc5334b048565 upstream.

When using kernel with the following extra config,

  - CONFIG_KASAN=y
  - CONFIG_KASAN_GENERIC=y
  - CONFIG_KASAN_INLINE=y
  - CONFIG_KASAN_VMALLOC=y
  - CONFIG_FRAME_WARN=4096

kernel detects that snd_pcm_suspend_all() access a freed
'snd_soc_pcm_runtime' object when the system is suspended, which
leads to a use-after-free bug:

[   52.047746] BUG: KASAN: use-after-free in snd_pcm_suspend_all+0x1a8/0x270
[   52.047765] Read of size 1 at addr ffff0000b9434d50 by task systemd-sleep/2330

[   52.047785] Call trace:
[   52.047787]  dump_backtrace+0x0/0x3c0
[   52.047794]  show_stack+0x34/0x50
[   52.047797]  dump_stack_lvl+0x68/0x8c
[   52.047802]  print_address_description.constprop.0+0x74/0x2c0
[   52.047809]  kasan_report+0x210/0x230
[   52.047815]  __asan_report_load1_noabort+0x3c/0x50
[   52.047820]  snd_pcm_suspend_all+0x1a8/0x270
[   52.047824]  snd_soc_suspend+0x19c/0x4e0

The snd_pcm_sync_stop() has a NULL check on 'substream->runtime' before
making any access. So we need to always set 'substream->runtime' to NULL
everytime we kfree() it.

Fixes: a72706ed8208 ("ASoC: codec2codec: remove ephemeral variables")
Signed-off-by: robelin <robelin@nvidia.com>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://patch.msgid.link/20240823144342.4123814-2-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:20:59 +01:00
..
adi Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
amd Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
atmel Revert "ASoC: atmel: Remove system clock tree configuration for at91sam9g20ek" 2024-11-18 12:12:45 +01:00
au1x Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bcm Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cirrus Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
codecs ASoC: codecs: wsa881x: Correct Soundwire ports mask 2024-11-23 23:20:26 +01:00
dwc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fsl ASoC: fsl-asoc-card: set priv->pdev before using it 2024-11-19 14:19:31 +01:00
generic ASoC: Fix 7/8 spaces indentation in Kconfig 2024-11-19 11:32:42 +01:00
hisilicon Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
img Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel ASoC: Intel: use soc_intel_is_byt_cr() only when IOSF_MBI is reachable 2024-11-23 23:20:18 +01:00
jz4740 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kirkwood Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mediatek Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
meson ASoC: meson: cards: select SND_DYNAMIC_MINORS 2024-11-19 11:32:43 +01:00
mxs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pxa ARM: pxa: spitz: use gpio descriptors for audio 2024-11-23 23:20:06 +01:00
qcom Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rockchip Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
samsung sound: abox: Bump buffer sizes up 2024-11-17 17:40:16 +01:00
sh Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sirf Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sof ASoC: SOF: sof-pci-dev: Fix community key quirk detection 2024-11-18 12:11:11 +01:00
spear Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sprd Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sti Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stm Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sunxi ASoC: sunxi: sun4i-spdif: Add support for Allwinner H616 2024-11-18 22:25:33 +01:00
tegra ASoC: tegra: Fix DSPK 16-bit playback 2024-11-19 11:32:48 +01:00
ti ASoC: ti: omap-hdmi: Fix too long driver name 2024-11-19 14:19:48 +01:00
txx9 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uniphier Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ux500 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xilinx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xtensa Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
zte Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
soc-ac97.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
soc-acpi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
soc-card.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
soc-component.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
soc-compress.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
soc-core.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
soc-dai.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
soc-dapm.c ASoC: dapm: Fix UAF for snd_soc_pcm_runtime object 2024-11-23 23:20:59 +01:00
soc-devres.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
soc-generic-dmaengine-pcm.c ALSA: dmaengine: Synchronize dma channel after drop() 2024-11-19 14:19:48 +01:00
soc-jack.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
soc-link.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
soc-ops.c ASoC: ops: Fix wraparound for mask in snd_soc_get_volsw 2024-11-19 09:23:10 +01:00
soc-pcm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
soc-topology.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
soc-utils.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00