OSDN Git Service

UPSTREAM: ALSA: timer: Fix race among timer ioctls
authorTakashi Iwai <tiwai@suse.de>
Wed, 13 Jan 2016 16:48:01 +0000 (17:48 +0100)
committerMin Chong <mchong@google.com>
Tue, 23 Aug 2016 06:15:17 +0000 (23:15 -0700)
commita20900c4aa3596f6318568a662c71e0943b2bbd9
treee1c541e357adaa1aebda46703647cdafb8d380a0
parentca9b7b070b5833b9a7f4282df8a8484e5498630f
UPSTREAM: ALSA: timer: Fix race among timer ioctls

(cherry picked from commit af368027a49a751d6ff4ee9e3f9961f35bb4fede)

ALSA timer ioctls have an open race and this may lead to a
use-after-free of timer instance object.  A simplistic fix is to make
each ioctl exclusive.  We have already tread_sem for controlling the
tread, and extend this as a global mutex to be applied to each ioctl.

The downside is, of course, the worse concurrency.  But these ioctls
aren't to be parallel accessible, in anyway, so it should be fine to
serialize there.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Change-Id: I1ac52f1cba5e7408fd88c8fc1c30ca2e83967ebb
Bug: 28694392
sound/core/timer.c