linux-stable/sound
Takashi Iwai e39afd6095 ALSA: usb-audio: Fix recursive locking at XRUN during syncing
[ Upstream commit 8c721c53dd ]

The recent support of low latency playback in USB-audio driver made
the snd_usb_queue_pending_output_urbs() function to be called via PCM
ack ops.  In the new code path, the function is performed already in
the PCM stream lock.  The problem is that, when an XRUN is detected,
the function calls snd_pcm_xrun() to notify, but snd_pcm_xrun() is
supposed to be called only outside the stream lock.  As a result, it
leads to a deadlock of PCM stream locking.

For avoiding such a recursive locking, this patch adds an additional
check to the code paths in PCM core that call the ack callback; now it
checks the error code from the callback, and if it's -EPIPE, the XRUN
is handled in the PCM core side gracefully.  Along with it, the
USB-audio driver code is changed to follow that, i.e. -EPIPE is
returned instead of the explicit snd_pcm_xrun() call when the function
is performed already in the stream lock.

Fixes: d5f871f89e ("ALSA: usb-audio: Improved lowlatency playback support")
Reported-and-tested-by: John Keeping <john@metanate.com>
Link: https://lore.kernel.org/r/20230317195128.3911155-1-john@metanate.com
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Reviewed-by; Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230320142838.494-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-06 12:10:43 +02:00
..
ac97
aoa ALSA: aoa: Fix I2S device accounting 2022-10-27 08:53:08 +02:00
arm ALSA: arm: pxa: pxa2xx-ac97-lib: fix return value check of platform_get_irq() 2022-10-29 10:45:27 +02:00
atmel
core ALSA: usb-audio: Fix recursive locking at XRUN during syncing 2023-04-06 12:10:43 +02:00
drivers ALSA: mts64: fix possible null-ptr-defer in snd_mts64_interrupt 2022-12-31 13:32:22 +01:00
firewire ALSA: firewire-motu: fix unreleased lock warning in hwdep device 2023-02-09 11:28:08 +01:00
hda ALSA: hda: intel-dsp-config: add MTL PCI id 2023-03-22 13:34:00 +01:00
i2c
isa ALSA: sb: Use DIV_ROUND_UP() instead of open-coding it 2022-09-29 08:11:55 +02:00
mips
oss
parisc
pci ALSA: hda/ca0132: fixup buffer overrun at tuning_ctl_set() 2023-04-06 12:10:40 +02:00
pcmcia
ppc sound updates for 6.1-rc1 2022-10-05 12:02:07 -07:00
sh
soc ASoC: SOF: IPC4: update gain ipc msg definition to align with fw 2023-04-06 12:10:39 +02:00
sparc
spi
synth ALSA: emux: Avoid potential array out-of-bound in snd_emux_xg_control() 2023-02-14 19:11:41 +01:00
usb ALSA: usb-audio: Fix recursive locking at XRUN during syncing 2023-04-06 12:10:43 +02:00
virtio
x86
xen
ac97_bus.c
Kconfig
last.c
Makefile
sound_core.c