summaryrefslogtreecommitdiff
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2023-07-18 16:12:54 +0200
committerTakashi Iwai <tiwai@suse.de>2023-07-20 10:00:02 +0200
commitd4e99962d16ce60ac9ecf995489dc60d7854f1bd (patch)
tree03356be7a3cac250abdc36bb20141385e2c217cc /sound/core
parentfdf0eaf11452d72945af31804e2a1048ee1b574c (diff)
ALSA: control: Take card->controls_rwsem in snd_ctl_rename()
snd_ctl_rename() expects that card->controls_rwsem is held in the caller side for avoiding possible races, but actually no one really did that. It's likely because this operation is done usually only at the device initialization where no race can happen. But, it's still safer to take a lock, so we just take the lock inside snd_ctl_rename() like most of other API functions do. Link: https://lore.kernel.org/r/20230718141304.1032-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/control.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index 8386b53acdcd..a41d19c46df2 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -769,11 +769,12 @@ EXPORT_SYMBOL(snd_ctl_rename_id);
*
* Renames the specified control on the card to the new name.
*
- * Make sure to take the control write lock - down_write(&card->controls_rwsem).
+ * Note that this function takes card->controls_rwsem lock internally.
*/
void snd_ctl_rename(struct snd_card *card, struct snd_kcontrol *kctl,
const char *name)
{
+ down_write(&card->controls_rwsem);
remove_hash_entries(card, kctl);
if (strscpy(kctl->id.name, name, sizeof(kctl->id.name)) < 0)
@@ -781,6 +782,7 @@ void snd_ctl_rename(struct snd_card *card, struct snd_kcontrol *kctl,
name, kctl->id.name);
add_hash_entries(card, kctl);
+ up_write(&card->controls_rwsem);
}
EXPORT_SYMBOL(snd_ctl_rename);
office-4-1-6 Unnamed repository; edit this file to name it for gitweb.root
summaryrefslogtreecommitdiff
AgeCommit message (Expand)AuthorFilesLines
2024-11-28French and German translation of Conditional Formatting dialogcp-24.04.11-1cp-24.04.10-3cp-24.04.10-2co-24.04.11-1distro/collabora/co-24.04Andras Timar1-711/+1279
2024-11-11update translations for 24.2.7 rc2cp-24.04.10-1Christian Lohmaier246-12944/+10125
2024-10-18Follow-up commit to core d3bc1970fa9bd7acf7a6d0a2e1dba756cfc70e86cp-24.04.9-3cp-24.04.9-2cp-24.04.9-1Andras Timar128-129/+129
2024-10-17German translation for "Improve grammar check popups from Duden"Andras Timar1-0/+15
2024-10-15update translations for 24.2.7 rc1Christian Lohmaier572-15177/+17480
2024-09-11update translations for 24.2.6 rc2cp-24.04.8-2cp-24.04.8-1cp-24.04.7-3cp-24.04.7-2Christian Lohmaier23-501/+501
2024-09-11update translations for 24.2.6 rc2Christian Lohmaier197-2935/+2885
2024-09-11update translations for 24.2.6 rc1Christian Lohmaier746-17182/+18007
2024-09-11update translations for 24.2.5 rc2Christian Lohmaier195-2778/+2804
2024-07-03update translations for 24.2.5 rc1cp-24.04.7-1cp-24.04.6-3cp-24.04.5-2cp-24.04.5-1Christian Lohmaier237-1516/+1421
2024-07-03update translations for 24.2.5 rc1Christian Lohmaier415-5218/+5205
2024-06-24update translations for 24.2.4 rc2Christian Lohmaier90-793/+781
2024-06-03update translations for 24.2.4 rc2cp-24.04.4-5cp-24.04.4-4cp-24.04.4-3cp-24.04.4-2co-24.04.4-4Christian Lohmaier486-33672/+32762
2024-06-03update translations for 24.2.4 rc1Christian Lohmaier529-32993/+29625
2024-06-03update translations for 24.2.3 rc2Christian Lohmaier309-5301/+5274
2024-04-19update translations for 24.2.3 rc1cp-24.04.3-6cp-24.04.3-5cp-24.04.3-4cp-24.04.3-2cp-24.04.3-1cp-24.04.1-3co-24.04.3-2Christian Lohmaier81-860/+829
2024-04-19update translations for 24.2.3 rc1Christian Lohmaier