Skip to contentSkip to conversation

Echoaudio, fix Guru Meditation #00000005.48454C50

PATCH In review Giuliano Pochini 2 participants 2 messages Feb 16, 2010 – Feb 17, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Echoaudio, fix Guru Meditation #00000005.48454C50

(resend: I mistyped the list address)

There is a small window between the hw_params() callback and when runtime->frame_bits is set by ALSA middle layer. When another substream is already running, if an interrupt is delivered during that window the irq handler calls pcm_pointer() which does a division by zero. The patch below makes the irq handler skip substreams that are initialized but not started yet. Cc to Clemens Ladisch because he proposed an alternate fix.

For more information, please read the original thread in the linux-kernel mailing list: http://lkml.org/lkml/2010/2/2/187

Short description: This patch fixes a division by zero error in the irq handler.

alsa-kernel/pci/echoaudio/echoaudio.c renamed from alsa-kernel/pci/echoaudio/echoaudio.c__orig +3 -1
@@ -1864,7 +1864,9 @@ static irqreturn_t snd_echo_interrupt(in
 	/* The hardware doesn't tell us which substream caused the irq,
 	thus we have to check all running substreams. */
 	for (ss = 0; ss < DSP_MAXPIPES; ss++) {
-		if ((substream = chip->substream[ss])) {
+		substream = chip->substream[ss];
+		if (substream && ((struct audiopipe *)substream->runtime->
+				private_data)->state == PIPE_STATE_STARTED) {
 			period = pcm_pointer(substream) /
 				substream->runtime->period_size;
 			if (period != chip->last_period[ss]) {
Signature · 1 line
Giuliano.
#1 lore raw

At Wed, 17 Feb 2010 00:57:44 +0100,

Quoted 10 lines · Giuliano Pochini

(resend: I mistyped the list address)

There is a small window between the hw_params() callback and when runtime->frame_bits is set by ALSA middle layer. When another substream is already running, if an interrupt is delivered during that window the irq handler calls pcm_pointer() which does a division by zero. The patch below makes the irq handler skip substreams that are initialized but not started yet. Cc to Clemens Ladisch because he proposed an alternate fix.

Quoted 8 lines

For more information, please read the original thread in the linux-kernel mailing list: http://lkml.org/lkml/2010/2/2/187

Short description: This patch fixes a division by zero error in the irq handler.

Applied now. Thanks.

Takashi

Quoted 18 lines
alsa-kernel/pci/echoaudio/echoaudio.c renamed from alsa-kernel/pci/echoaudio/echoaudio.c__orig +3 -1
@@ -1864,7 +1864,9 @@ static irqreturn_t snd_echo_interrupt(in
 	/* The hardware doesn't tell us which substream caused the irq,
 	thus we have to check all running substreams. */
 	for (ss = 0; ss < DSP_MAXPIPES; ss++) {
-		if ((substream = chip->substream[ss])) {
+		substream = chip->substream[ss];
+		if (substream && ((struct audiopipe *)substream->runtime->
+				private_data)->state == PIPE_STATE_STARTED) {
 			period = pcm_pointer(substream) /
 				substream->runtime->period_size;
 			if (period != chip->last_period[ss]) {
Signature · 2 lines
-- 
Giuliano.