]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ALSA: seq: Avoid client data changes during proc reads
authorTakashi Iwai <tiwai@suse.de>
Fri, 7 Mar 2025 08:42:43 +0000 (09:42 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 7 Mar 2025 08:44:46 +0000 (09:44 +0100)
The proc read of each client should protect against the concurrent
data changes to keep the data consistent; although they are supposed
to be safe and won't crash things, it doesn't guarantee the
consistency between the read values.  Take client->ioctl_mutex for
protecting against the concurrent changes.

Link: https://patch.msgid.link/20250307084246.29271-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/seq/seq_clientmgr.c

index 659494e00c513007da9a7b51bb0479568a69af4e..fe7cd0649c98633a53f30681f6adb2c9abcf5d51 100644 (file)
@@ -2706,6 +2706,7 @@ void snd_seq_info_clients_read(struct snd_info_entry *entry,
                        continue;
                }
 
+               mutex_lock(&client->ioctl_mutex);
                snd_iprintf(buffer, "Client %3d : \"%s\" [%s %s]\n",
                            c, client->name,
                            client->type == USER_CLIENT ? "User" : "Kernel",
@@ -2723,6 +2724,7 @@ void snd_seq_info_clients_read(struct snd_info_entry *entry,
                        snd_iprintf(buffer, "  Input pool :\n");
                        snd_seq_info_pool(buffer, client->data.user.fifo->pool, "    ");
                }
+               mutex_unlock(&client->ioctl_mutex);
                snd_seq_client_unlock(client);
        }
 }