diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-03-24 09:50:15 +0100 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-03-14 10:56:50 -0400 |
commit | dc9080910ea215e2252c0a0e57e27ca51e733db0 (patch) | |
tree | fa5dcb5a9aff27f69c32ddeafe0283e497265f7f /sound | |
parent | 2fa60a045682ebce0fcc19d5e50ada2a0135cb16 (diff) |
ALSA: Fix yet another race in disconnection
commit a45e3d6b13e97506b616980c0f122c3389bcefa4 upstream.
This patch fixes a race between snd_card_file_remove() and
snd_card_disconnect(). When the card is added to shutdown_files list
in snd_card_disconnect(), but it's freed in snd_card_file_remove() at
the same time, the shutdown_files list gets corrupted. The list member
must be freed in snd_card_file_remove() as well.
Reported-and-tested-by: Russ Dill <russ.dill@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/init.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/core/init.c b/sound/core/init.c index ec4a50ce5656..82f350e00cbe 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -848,6 +848,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file) return -ENOMEM; mfile->file = file; mfile->disconnected_f_op = NULL; + INIT_LIST_HEAD(&mfile->shutdown_list); spin_lock(&card->files_lock); if (card->shutdown) { spin_unlock(&card->files_lock); @@ -883,6 +884,9 @@ int snd_card_file_remove(struct snd_card *card, struct file *file) list_for_each_entry(mfile, &card->files_list, list) { if (mfile->file == file) { list_del(&mfile->list); + spin_lock(&shutdown_lock); + list_del(&mfile->shutdown_list); + spin_unlock(&shutdown_lock); if (mfile->disconnected_f_op) fops_put(mfile->disconnected_f_op); found = mfile; |