]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: timer: Fix negative queue usage by racy accesses
authorTakashi Iwai <tiwai@suse.de>
Mon, 4 Jul 2016 12:02:15 +0000 (14:02 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 4 Jul 2016 12:02:15 +0000 (14:02 +0200)
commitb602430a28e4e4feacf77ff205f08349a8731f99
treed42f578d6f7f0ef27f4f556a36afe643636e5ad1
parentc8253d895aacef0638d3f61c53e654c501e9a708
ALSA: timer: Fix negative queue usage by racy accesses

The user timer tu->qused counter may go to a negative value when
multiple concurrent reads are performed since both the check and the
decrement of tu->qused are done in two individual locked contexts.
This results in bogus read outs, and the endless loop in the
user-space side.

The fix is to move the decrement of the tu->qused counter into the
same spinlock context as the zero-check of the counter.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/timer.c