diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-10-16 16:43:39 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-10-30 11:07:15 +0100 |
commit | 0914f7961babbf28aaa2f19b453951fb4841c03f (patch) | |
tree | fe5c14256a1d7b2116341300dd1e8ed94ac5f576 /sound/core/hwdep.c | |
parent | a0830dbd4e42b38aefdf3fb61ba5019a1a99ea85 (diff) | |
download | linux-0914f7961babbf28aaa2f19b453951fb4841c03f.tar.bz2 |
ALSA: Avoid endless sleep after disconnect
When disconnect callback is called, each component should wake up
sleepers and check card->shutdown flag for avoiding the endless sleep
blocking the proper resource release.
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/hwdep.c')
-rw-r--r-- | sound/core/hwdep.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 53a6ba5ad615..3f7f6628cf7b 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -131,6 +131,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) mutex_unlock(&hw->open_mutex); schedule(); mutex_lock(&hw->open_mutex); + if (hw->card->shutdown) { + err = -ENODEV; + break; + } if (signal_pending(current)) { err = -ERESTARTSYS; break; @@ -462,12 +466,15 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device) mutex_unlock(®ister_mutex); return -EINVAL; } + mutex_lock(&hwdep->open_mutex); + wake_up(&hwdep->open_wait); #ifdef CONFIG_SND_OSSEMUL if (hwdep->ossreg) snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device); #endif snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device); list_del_init(&hwdep->list); + mutex_unlock(&hwdep->open_mutex); mutex_unlock(®ister_mutex); return 0; } |