]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: seq: Don't break snd_use_lock_sync() loop by timeout
authorTakashi Iwai <tiwai@suse.de>
Sun, 9 Apr 2017 08:41:27 +0000 (10:41 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 13 Apr 2017 12:13:25 +0000 (14:13 +0200)
commit5f2ff3d0d0fa3ed993a0cf4a8ff1a6e4cfed4d9d
tree62eb024027ea491fe0c040dc9f0f2d906b6e0643
parent7d1864958fb45e87909fed2f81afe88a5804adc4
ALSA: seq: Don't break snd_use_lock_sync() loop by timeout

The snd_use_lock_sync() (thus its implementation
snd_use_lock_sync_helper()) has the 5 seconds timeout to break out of
the sync loop.  It was introduced from the beginning, just to be
"safer", in terms of avoiding the stupid bugs.

However, as Ben Hutchings suggested, this timeout rather introduces a
potential leak or use-after-free that was apparently fixed by the
commit a15f95ffaefa ("ALSA: seq: Fix race during FIFO resize"):
for example, snd_seq_fifo_event_in() -> snd_seq_event_dup() ->
copy_from_user() could block for a long time, and snd_use_lock_sync()
goes timeout and still leaves the cell at releasing the pool.

For fixing such a problem, we remove the break by the timeout while
still keeping the warning.

Suggested-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/seq/seq_lock.c