X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=sound%2Fdrivers%2Faloop.c;fp=sound%2Fdrivers%2Faloop.c;h=4e01b027f74638a1cdd077a9bb9ecf0edff5c380;hb=6acf1f11d393616cfd6cd8417e2dfe7da89bf9eb;hp=3fa12d9de3bee0ec843f525ec55626aa433ed79d;hpb=dc602c18947a838a422071849965ce611f9a18e1;p=pandora-kernel.git diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c index 3fa12d9de3be..4e01b027f746 100644 --- a/sound/drivers/aloop.c +++ b/sound/drivers/aloop.c @@ -656,7 +656,9 @@ static void free_cable(struct snd_pcm_substream *substream) return; if (cable->streams[!substream->stream]) { /* other stream is still alive */ + spin_lock_irq(&cable->lock); cable->streams[substream->stream] = NULL; + spin_unlock_irq(&cable->lock); } else { /* free the cable */ loopback->cables[substream->number][dev] = NULL; @@ -697,7 +699,6 @@ static int loopback_open(struct snd_pcm_substream *substream) loopback->cables[substream->number][dev] = cable; } dpcm->cable = cable; - cable->streams[substream->stream] = dpcm; snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); @@ -729,6 +730,11 @@ static int loopback_open(struct snd_pcm_substream *substream) runtime->hw = loopback_pcm_hardware; else runtime->hw = cable->hw; + + spin_lock_irq(&cable->lock); + cable->streams[substream->stream] = dpcm; + spin_unlock_irq(&cable->lock); + unlock: if (err < 0) { free_cable(substream);