diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-10-16 10:43:39 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-10-30 06:07:15 -0400 |
commit | 0914f7961babbf28aaa2f19b453951fb4841c03f (patch) | |
tree | fe5c14256a1d7b2116341300dd1e8ed94ac5f576 /sound/core/pcm_native.c | |
parent | a0830dbd4e42b38aefdf3fb61ba5019a1a99ea85 (diff) |
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/pcm_native.c')
-rw-r--r-- | sound/core/pcm_native.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 48c6a70ad69e..6e8872de5ba0 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1518,6 +1518,10 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, | |||
1518 | down_read(&snd_pcm_link_rwsem); | 1518 | down_read(&snd_pcm_link_rwsem); |
1519 | snd_pcm_stream_lock_irq(substream); | 1519 | snd_pcm_stream_lock_irq(substream); |
1520 | remove_wait_queue(&to_check->sleep, &wait); | 1520 | remove_wait_queue(&to_check->sleep, &wait); |
1521 | if (card->shutdown) { | ||
1522 | result = -ENODEV; | ||
1523 | break; | ||
1524 | } | ||
1521 | if (tout == 0) { | 1525 | if (tout == 0) { |
1522 | if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) | 1526 | if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) |
1523 | result = -ESTRPIPE; | 1527 | result = -ESTRPIPE; |
@@ -2169,6 +2173,10 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) | |||
2169 | mutex_unlock(&pcm->open_mutex); | 2173 | mutex_unlock(&pcm->open_mutex); |
2170 | schedule(); | 2174 | schedule(); |
2171 | mutex_lock(&pcm->open_mutex); | 2175 | mutex_lock(&pcm->open_mutex); |
2176 | if (pcm->card->shutdown) { | ||
2177 | err = -ENODEV; | ||
2178 | break; | ||
2179 | } | ||
2172 | if (signal_pending(current)) { | 2180 | if (signal_pending(current)) { |
2173 | err = -ERESTARTSYS; | 2181 | err = -ERESTARTSYS; |
2174 | break; | 2182 | break; |