summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-06-18 13:32:31 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-06-26 15:17:37 -0400
commitfe0b62710bf550939e26635773f3ca1e8ea23f4e (patch)
tree960e29d1b70ce0c60612507272b39088e6d8fbd8 /include
parente620115fc90a633dbf507bcd540b177e8c80c60a (diff)
ALSA: control: Protect user controls against concurrent access
commit 07f4d9d74a04aa7c72c5dae0ef97565f28f17b92 upstream. The user-control put and get handlers as well as the tlv do not protect against concurrent access from multiple threads. Since the state of the control is not updated atomically it is possible that either two write operations or a write and a read operation race against each other. Both can lead to arbitrary memory disclosure. This patch introduces a new lock that protects user-controls from concurrent access. Since applications typically access controls sequentially than in parallel a single lock per card should be fine. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/sound/core.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/sound/core.h b/include/sound/core.h
index d3f5f818e0b9..88c9fbb7ed90 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -116,6 +116,8 @@ struct snd_card {
int user_ctl_count; /* count of all user controls */
struct list_head controls; /* all controls for this card */
struct list_head ctl_files; /* active control files */
+ struct mutex user_ctl_lock; /* protects user controls against
+ concurrent access */
struct snd_info_entry *proc_root; /* root for soundcard specific files */
struct snd_info_entry *proc_id; /* the card id */