瀏覽代碼

[ALSA] check for linked substreams of different cards

It is possible to have linked substreams that belong to different cards
and/or different drivers.  This patch changes some drivers to make sure
that they do not incorrectly try to handle substreams of a different
card.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Clemens Ladisch 18 年之前
父節點
當前提交
29998d24ab
共有 4 個文件被更改,包括 14 次插入4 次删除
  1. 3 0
      sound/pci/ca0106/ca0106_main.c
  2. 3 0
      sound/pci/emu10k1/p16v.c
  3. 6 4
      sound/pci/ice1712/ice1724.c
  4. 2 0
      sound/pci/pcxhr/pcxhr.c

+ 3 - 0
sound/pci/ca0106/ca0106_main.c

@@ -853,6 +853,9 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream,
 		break;
 	}
         snd_pcm_group_for_each_entry(s, substream) {
+		if (snd_pcm_substream_chip(s) != emu ||
+		    s->stream != SNDRV_PCM_STREAM_PLAYBACK)
+			continue;
 		runtime = s->runtime;
 		epcm = runtime->private_data;
 		channel = epcm->channel_id;

+ 3 - 0
sound/pci/emu10k1/p16v.c

@@ -448,6 +448,9 @@ static int snd_p16v_pcm_trigger_playback(struct snd_pcm_substream *substream,
 		break;
 	}
         snd_pcm_group_for_each_entry(s, substream) {
+		if (snd_pcm_substream_chip(s) != emu ||
+		    s->stream != SNDRV_PCM_STREAM_PLAYBACK)
+			continue;
 		runtime = s->runtime;
 		epcm = runtime->private_data;
 		channel = substream->pcm->device-emu->p16v_device_offset;

+ 6 - 4
sound/pci/ice1712/ice1724.c

@@ -341,10 +341,12 @@ static int snd_vt1724_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 
 	what = 0;
 	snd_pcm_group_for_each_entry(s, substream) {
-		const struct vt1724_pcm_reg *reg;
-		reg = s->runtime->private_data;
-		what |= reg->start;
-		snd_pcm_trigger_done(s, substream);
+		if (snd_pcm_substream_chip(s) == ice) {
+			const struct vt1724_pcm_reg *reg;
+			reg = s->runtime->private_data;
+			what |= reg->start;
+			snd_pcm_trigger_done(s, substream);
+		}
 	}
 
 	switch (cmd) {

+ 2 - 0
sound/pci/pcxhr/pcxhr.c

@@ -646,6 +646,8 @@ static int pcxhr_trigger(struct snd_pcm_substream *subs, int cmd)
 		if (snd_pcm_stream_linked(subs)) {
 			struct snd_pcxhr *chip = snd_pcm_substream_chip(subs);
 			snd_pcm_group_for_each_entry(s, subs) {
+				if (snd_pcm_substream_chip(s) != chip)
+					continue;
 				stream = s->runtime->private_data;
 				stream->status =
 					PCXHR_STREAM_STATUS_SCHEDULE_RUN;