linux-sg2042/sound/drivers
Takashi Iwai 898dfe4687 ALSA: aloop: Fix racy hw constraints adjustment
The aloop driver tries to update the hw constraints of the connected
target on the cable of the opened PCM substream.  This is done by
adding the extra hw constraints rules referring to the substream
runtime->hw fields, while the other substream may update the runtime
hw of another side on the fly.

This is, however, racy and may result in the inconsistent values when
both PCM streams perform the prepare concurrently.  One of the reason
is that it overwrites the other's runtime->hw field; which is not only
racy but also broken when it's called before the open of another side
finishes.  And, since the reference to runtime->hw isn't protected,
the concurrent write may give the partial value update and become
inconsistent.

This patch is an attempt to fix and clean up:
- The prepare doesn't change the runtime->hw of other side any longer,
  but only update the cable->hw that is referred commonly.
- The extra rules refer to the loopback_pcm object instead of the
  runtime->hw.  The actual hw is deduced from cable->hw.
- The extra rules take the cable_lock to protect against the race.

Fixes: b1c73fc8e6 ("ALSA: snd-aloop: Fix hw_params restrictions and checking")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-01-05 16:44:16 +01:00
..
mpu401 ALSA: drivers: Convert timers to use timer_setup() 2017-10-24 21:01:16 +02:00
opl3 ASoC: Updates for v4.15 2017-11-13 15:45:57 +01:00
opl4 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pcsp License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vx ALSA: vx: Put missing KERN_CONT prefix 2017-08-31 11:01:17 +02:00
Kconfig ALSA: seq: Allow the modular sequencer registration 2017-06-12 08:43:33 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
aloop.c ALSA: aloop: Fix racy hw constraints adjustment 2018-01-05 16:44:16 +01:00
dummy.c ALSA: drivers: Convert timers to use timer_setup() 2017-10-24 21:01:16 +02:00
ml403-ac97cr.c ALSA: drivers: constify snd_pcm_ops structures 2017-08-19 11:02:15 +02:00
mtpav.c ALSA: drivers: Convert timers to use timer_setup() 2017-10-24 21:01:16 +02:00
mts64.c ALSA: drivers: Constify snd_rawmidi_ops 2017-01-12 12:50:06 +01:00
pcm-indirect2.c treewide: Fix typos in printk 2015-12-08 14:59:19 +01:00
pcm-indirect2.h [ALSA] Xilinx ML403 AC97 Controller Reference device driver 2008-01-31 17:29:15 +01:00
portman2x4.c ALSA: drivers: Constify snd_rawmidi_ops 2017-01-12 12:50:06 +01:00
serial-u16550.c ALSA: drivers: Convert timers to use timer_setup() 2017-10-24 21:01:16 +02:00
virmidi.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00