]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ALSA: seq: Clear client entry before deleting else at closing
authorTakashi Iwai <tiwai@suse.de>
Fri, 9 Mar 2018 21:23:31 +0000 (22:23 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 16 Jun 2018 21:22:37 +0000 (22:22 +0100)
commit3bdc246fac7ac59b962dbd91c4f73c22dc9598db
treefac5d2016e5ffbd292835d8f9611e5cbf0a1d83b
parent7880783d9f12817f528c9e1fa587e6bb5371afc2
ALSA: seq: Clear client entry before deleting else at closing

commit a2ff19f7b70118ced291a28d5313469914de451b upstream.

When releasing a client, we need to clear the clienttab[] entry at
first, then call snd_seq_queue_client_leave().  Otherwise, the
in-flight cell in the queue might be picked up by the timer interrupt
via snd_seq_check_queue() before calling snd_seq_queue_client_leave(),
and it's delivered to another queue while the client is clearing
queues.  This may eventually result in an uncleared cell remaining in
a queue, and the later snd_seq_pool_delete() may need to wait for a
long time until the event gets really processed.

By moving the clienttab[] clearance at the beginning of release, any
event delivery of a cell belonging to this client will fail at a later
point, since snd_seq_client_ptr() returns NULL.  Thus the cell that
was picked up by the timer interrupt will be returned immediately
without further delivery, and the long stall of snd_seq_delete_pool()
can be avoided, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
sound/core/seq/seq_clientmgr.c