ALSA: use correct lock in snd_ctl_dev_disconnect()

The lock used in snd_ctl_dev_disconnect() should be card->ctl_files_rwlock
for protection of card->ctl_files entries, instead of card->controls_rwsem.

Reported-by: Vegard Nossum <vegard.nossum@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Takashi Iwai 2008-09-07 12:51:13 +02:00 committed by Jaroslav Kysela
parent 3d8cb466a8
commit d8009882e9
1 changed files with 2 additions and 2 deletions

View File

@ -1438,12 +1438,12 @@ static int snd_ctl_dev_disconnect(struct snd_device *device)
if (snd_BUG_ON(cardnum < 0 || cardnum >= SNDRV_CARDS)) if (snd_BUG_ON(cardnum < 0 || cardnum >= SNDRV_CARDS))
return -ENXIO; return -ENXIO;
down_read(&card->controls_rwsem); read_lock(&card->ctl_files_rwlock);
list_for_each_entry(ctl, &card->ctl_files, list) { list_for_each_entry(ctl, &card->ctl_files, list) {
wake_up(&ctl->change_sleep); wake_up(&ctl->change_sleep);
kill_fasync(&ctl->fasync, SIGIO, POLL_ERR); kill_fasync(&ctl->fasync, SIGIO, POLL_ERR);
} }
up_read(&card->controls_rwsem); read_unlock(&card->ctl_files_rwlock);
if ((err = snd_unregister_device(SNDRV_DEVICE_TYPE_CONTROL, if ((err = snd_unregister_device(SNDRV_DEVICE_TYPE_CONTROL,
card, -1)) < 0) card, -1)) < 0)