alsa-lib/src
Takashi Iwai df483d3fe5 pcm: Fix the wrong PCM object passed for locking/unlocking
Most of PCM API functions have snd_pcm_lock()/unlock() wraps for the
actual calls of ops, and some plugins try to unlock/relock internally
for the given PCM object.  This, unfortunately, causes a problem in
some configurations and leads to the unexpected behavior or deadlock.

The main problem is that we call snd_pcm_lock() with the given PCM
object, while calling the ops with pcm->op_arg or pcm->fast_op_arg as
the slave PCM object.  Meanwhile the plugin code assumes that the
passed PCM object is already locked, and calls snd_pcm_unlock().
This bug doesn't hit always because in most cases pcm->op_arg and
fast_op_arg are identical with pcm itself.  But in some configurations
they have different values, so the problem surfaces.

This patch is an attempt to resolve these inconsistencies.  It
replaces most of snd_pcm_lock()/unlock() calls with either pcm->op_arg
or pcm->fast_op_arg, depending on the call pattern, so that the plugin
code can safely run snd_pcm_unlock() to the given PCM object.

Fixes: 54931e5a54 ("pcm: Add thread-safety to PCM API")
Reported-by: Ben Russell <thematrixeatsyou@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-09-24 13:55:16 +02:00
..
alisp alisp: add the missing include 2019-03-15 13:16:20 +01:00
conf ucm: Add UCM profile for CX2072X codec on Baytrail/Cherrytrail profiles 2019-05-23 17:42:42 +02:00
control control_shm: add missing socket close to the error path (coverity) 2019-05-24 21:25:50 +02:00
hwdep core: Proper reference of internal snd_dlopen() 2018-01-04 15:29:57 +01:00
mixer core: Proper reference of internal snd_dlopen() 2018-01-04 15:29:57 +01:00
pcm pcm: Fix the wrong PCM object passed for locking/unlocking 2019-09-24 13:55:16 +02:00
rawmidi rawmidi_hw: add sanity check for the invalid stream arguments (coverity) 2019-05-24 21:25:50 +02:00
seq add snd_strlcpy() and use it everywhere 2019-03-25 16:46:05 +01:00
timer add support for GCC's LTO 2019-04-09 12:44:14 +02:00
topology topology: Fix variable overflow in split_format 2019-08-27 09:37:32 +02:00
ucm ucm: another coverity fix in uc_mgr_config_load() 2019-05-27 20:10:52 +02:00
async.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
conf.c conf: List cases in range explicitly 2019-06-12 08:52:24 +02:00
confmisc.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
dlmisc.c rawmidi: use snd_dlobj_cache_get2() in rawmidi open (coverity) 2019-05-24 21:25:50 +02:00
error.c add snd_strlcpy() and use it everywhere 2019-03-25 16:46:05 +01:00
input.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
Makefile.am topology: autotools: Add build support for topology core 2015-07-30 17:10:14 +02:00
names.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
output.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
shmarea.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
socket.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
userfile.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
Versions.in Change snd_dlopen() function to return the error string 2017-11-27 21:48:20 +01:00