aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-03-09 16:23:31 -0500
committerTakashi Iwai <tiwai@suse.de>2018-03-10 11:30:01 -0500
commita2ff19f7b70118ced291a28d5313469914de451b (patch)
treec298a34bc11603591b75e30f9b105187d0735471
parentd0f833065221cbfcbadf19fd4102bcfa9330006a (diff)
ALSA: seq: Clear client entry before deleting else at closing
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. Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/core/seq/seq_clientmgr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 918338dea5b9..61a07fe34cd2 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -255,12 +255,12 @@ static int seq_free_client1(struct snd_seq_client *client)
255 255
256 if (!client) 256 if (!client)
257 return 0; 257 return 0;
258 snd_seq_delete_all_ports(client);
259 snd_seq_queue_client_leave(client->number);
260 spin_lock_irqsave(&clients_lock, flags); 258 spin_lock_irqsave(&clients_lock, flags);
261 clienttablock[client->number] = 1; 259 clienttablock[client->number] = 1;
262 clienttab[client->number] = NULL; 260 clienttab[client->number] = NULL;
263 spin_unlock_irqrestore(&clients_lock, flags); 261 spin_unlock_irqrestore(&clients_lock, flags);
262 snd_seq_delete_all_ports(client);
263 snd_seq_queue_client_leave(client->number);
264 snd_use_lock_sync(&client->use_lock); 264 snd_use_lock_sync(&client->use_lock);
265 snd_seq_queue_client_termination(client->number); 265 snd_seq_queue_client_termination(client->number);
266 if (client->pool) 266 if (client->pool)