alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH 03/10] ALSA: 6fire: Fix unlocked snd_pcm_stop() call
Date: Mon, 15 Jul 2013 15:06:15 +0200	[thread overview]
Message-ID: <1373893582-17116-4-git-send-email-tiwai@suse.de> (raw)
In-Reply-To: <1373893582-17116-1-git-send-email-tiwai@suse.de>

snd_pcm_stop() must be called in the PCM substream lock context.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/6fire/pcm.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
index c5b9cac..2aa4e13 100644
--- a/sound/usb/6fire/pcm.c
+++ b/sound/usb/6fire/pcm.c
@@ -639,17 +639,25 @@ int usb6fire_pcm_init(struct sfire_chip *chip)
 void usb6fire_pcm_abort(struct sfire_chip *chip)
 {
 	struct pcm_runtime *rt = chip->pcm;
+	unsigned long flags;
 	int i;
 
 	if (rt) {
 		rt->panic = true;
 
-		if (rt->playback.instance)
+		if (rt->playback.instance) {
+			snd_pcm_stream_lock_irqsave(rt->playback.instance, flags);
 			snd_pcm_stop(rt->playback.instance,
 					SNDRV_PCM_STATE_XRUN);
-		if (rt->capture.instance)
+			snd_pcm_stream_unlock_irqrestore(rt->playback.instance, flags);
+		}
+
+		if (rt->capture.instance) {
+			snd_pcm_stream_lock_irqsave(rt->capture.instance, flags);
 			snd_pcm_stop(rt->capture.instance,
 					SNDRV_PCM_STATE_XRUN);
+			snd_pcm_stream_unlock_irqrestore(rt->capture.instance, flags);
+		}
 
 		for (i = 0; i < PCM_N_URBS; i++) {
 			usb_poison_urb(&rt->in_urbs[i].instance);
-- 
1.8.3.1

  parent reply	other threads:[~2013-07-15 13:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-15 13:06 [PATCH 0/10] snd_pcm_stop() lock fixes Takashi Iwai
2013-07-15 13:06 ` [PATCH 01/10] ALSA: asihpi: Fix unlocked snd_pcm_stop() call Takashi Iwai
2013-07-15 13:06 ` [PATCH 02/10] ALSA: atiixp: " Takashi Iwai
2013-07-15 13:06 ` Takashi Iwai [this message]
2013-07-15 13:06 ` [PATCH 04/10] ALSA: ua101: " Takashi Iwai
2013-07-15 19:01   ` Clemens Ladisch
2013-07-15 13:06 ` [PATCH 05/10] ALSA: usx2y: " Takashi Iwai
2013-07-15 13:06 ` [PATCH 06/10] ALSA: pxa2xx: " Takashi Iwai
2013-07-15 16:00   ` Mark Brown
2013-07-15 13:06 ` [PATCH 07/10] ASoC: atmel: " Takashi Iwai
2013-07-15 16:00   ` Mark Brown
2013-07-15 13:06 ` [PATCH 08/10] ASoC: s6000: " Takashi Iwai
2013-07-15 16:00   ` Mark Brown
2013-07-15 16:02   ` Daniel Glöckner
2013-07-15 16:05     ` Takashi Iwai
2013-07-15 13:06 ` [PATCH 09/10] [media] saa7134: " Takashi Iwai
2013-07-15 13:06 ` [PATCH 10/10] staging: line6: " Takashi Iwai
2013-07-15 13:12 ` [PATCH 0/10] snd_pcm_stop() lock fixes Jaroslav Kysela
2013-07-15 13:17   ` Takashi Iwai
2013-07-16 14:48     ` Takashi Iwai
2013-07-16 14:54       ` Lars-Peter Clausen
2013-07-16 15:10         ` Takashi Iwai
2013-07-16 15:57           ` Lars-Peter Clausen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1373893582-17116-4-git-send-email-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).