]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: seq: Fix concurrent access to queue current tick/time
authorTakashi Iwai <tiwai@suse.de>
Fri, 14 Feb 2020 11:13:15 +0000 (12:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Feb 2020 16:22:27 +0000 (17:22 +0100)
commit36f22cfdbce928ad0d8797d07793c48f9b61ef76
tree6f4cf743cc0a33d08501e5b9484931736e866a94
parent5ece6aa46a7cfd276dcdb2e771278809c6f1e74d
ALSA: seq: Fix concurrent access to queue current tick/time

commit 3c3e7e96a68c7e8e774c12dc8de807508608b50b upstream.

snd_seq_check_queue() passes the current tick and time of the given
queue as a pointer to snd_seq_prioq_cell_out(), but those might be
updated concurrently by the seq timer update.

Fix it by retrieving the current tick and time via the proper helper
functions at first, and pass those values to snd_seq_prioq_cell_out()
later in the loops.

snd_seq_timer_get_cur_time() takes a new argument and adjusts with the
current system time only when it's requested so; this update isn't
needed for snd_seq_check_queue(), as it's called either from the
interrupt handler or right after queuing.

Also, snd_seq_timer_get_cur_tick() is changed to read the value in the
spinlock for the concurrency, too.

Reported-by: syzbot+fd5e0eaa1a32999173b2@syzkaller.appspotmail.com
Link: https://lore.kernel.org/r/20200214111316.26939-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/core/seq/seq_clientmgr.c
sound/core/seq/seq_queue.c
sound/core/seq/seq_timer.c
sound/core/seq/seq_timer.h