linux-stable/sound/core/oss
Takashi Iwai b248371628 ALSA: pcm: Fix potential deadlock in OSS emulation
There are potential deadlocks in PCM OSS emulation code while
accessing read/write and mmap concurrently.  This comes from the
infamous mmap_sem usage in copy_from/to_user().  Namely,

   snd_pcm_oss_write() ->
     &runtime->oss.params_lock ->
        copy_to_user() ->
          &mm->mmap_sem
  mmap() ->
    &mm->mmap_sem ->
      snd_pcm_oss_mmap() ->
        &runtime->oss.params_lock

Since we can't avoid taking params_lock from mmap code path, use
trylock variant and aborts with -EAGAIN as a workaround of this AB/BA
deadlock.

BugLink: http://lkml.kernel.org/r/CACT4Y+bVrBKDG0G2_AcUgUQa+X91VKTeS4v+wN7BSHwHtqn3kQ@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-02-01 12:23:29 +01:00
..
Makefile [ALSA] Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz 2007-10-16 16:51:18 +02:00
copy.c ALSA: Kill snd_assert() in sound/core/* 2008-08-13 11:46:35 +02:00
io.c ALSA: Kill snd_assert() in sound/core/* 2008-08-13 11:46:35 +02:00
linear.c ALSA: core: remove unused variables. 2011-05-26 08:19:04 +02:00
mixer_oss.c ALSA: Fix compat_ioctl handling for OSS emulations 2015-12-03 17:40:21 +01:00
mulaw.c ALSA: core: sparse cleanups 2011-02-14 17:10:11 +01:00
pcm_oss.c ALSA: pcm: Fix potential deadlock in OSS emulation 2016-02-01 12:23:29 +01:00
pcm_plugin.c ALSA: core: fix NULL checking in snd_pcm_plug_slave_size() 2012-11-14 08:03:31 +01:00
pcm_plugin.h ALSA: core: sparse cleanups 2011-02-14 17:10:11 +01:00
rate.c ALSA: fix excessive background noise introduced by OSS emulation rate shrink 2009-02-23 07:49:04 +01:00
route.c ALSA: core: sparse cleanups 2011-02-14 17:10:11 +01:00