ALSA: timer: Protect the whole snd_timer_close() with open race
authorTakashi Iwai <tiwai@suse.de>
Wed, 10 Feb 2016 10:53:30 +0000 (11:53 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 1 Jan 2018 20:51:02 +0000 (20:51 +0000)
commita6a1f3005929d1a7ed35d683ba4ce2a12aad7395
tree43b36841b3e71b8624c3a3b749621ca0351d5837
parent9b4658f3daaf2070c871eac06fbee7cebeb18ce8
ALSA: timer: Protect the whole snd_timer_close() with open race

commit 9984d1b5835ca29fc7025186a891ee7398d21cc7 upstream.

In order to make the open/close more robust, widen the register_mutex
protection over the whole snd_timer_close() function.  Also, the close
procedure is slightly shuffled to be in the safer order, as well as a
few code refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
sound/core/timer.c