diff options
author | Takashi Iwai <tiwai@suse.de> | 2016-01-31 10:32:37 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-02-19 14:22:39 -0800 |
commit | aae80d6591f9d7c8e7aa48bad5b365c05ee9c2fd (patch) | |
tree | b15c57afe29bdf789a69f60f48857bcd53eb4a67 /sound/mips/hal2.c | |
parent | 264df9ec4e1f538b08167eae04ccfeb79678d111 (diff) | |
download | lwn-aae80d6591f9d7c8e7aa48bad5b365c05ee9c2fd.tar.gz lwn-aae80d6591f9d7c8e7aa48bad5b365c05ee9c2fd.zip |
ALSA: pcm: Fix potential deadlock in OSS emulation
commit b248371628aad599a48540962f6b85a21a8a0c3f upstream.
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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/mips/hal2.c')
0 files changed, 0 insertions, 0 deletions