ALSA: control: Protect user controls against concurrent access
authorLars-Peter Clausen <lars@metafoo.de>
Wed, 18 Jun 2014 11:32:31 +0000 (13:32 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 11 Jul 2014 12:33:51 +0000 (13:33 +0100)
commit7a3e84b9fd584f2f41600a69fe3cc317b2c34b14
treefc2c915b303077d9c18d9a1b6f3d77a1939e2ef2
parent389b175f41fdcca5af03cb9e0cb21283e910524c
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: Ben Hutchings <ben@decadent.org.uk>
include/sound/core.h
sound/core/control.c
sound/core/init.c