alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Echoaudio, fix Guru Meditation #00000005.48454C50
@ 2010-02-16 23:57 Giuliano Pochini
  2010-02-17 13:50 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Giuliano Pochini @ 2010-02-16 23:57 UTC (permalink / raw)
  To: alsa-devel; +Cc: Takashi Iwai, Clemens Ladisch

(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.


Signed-off-by: Giuliano Pochini <pochini@shiny.it>

--- alsa-driver-1.0.22.1/alsa-kernel/pci/echoaudio/echoaudio.c__orig	2010-02-16 22:21:36.000000000 +0100
+++ alsa-driver-1.0.22.1/alsa-kernel/pci/echoaudio/echoaudio.c	2010-02-16 22:21:45.000000000 +0100
@@ -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]) {


-- 
Giuliano.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Echoaudio, fix Guru Meditation #00000005.48454C50
  2010-02-16 23:57 [PATCH] Echoaudio, fix Guru Meditation #00000005.48454C50 Giuliano Pochini
@ 2010-02-17 13:50 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2010-02-17 13:50 UTC (permalink / raw)
  To: Giuliano Pochini; +Cc: alsa-devel, Clemens Ladisch

At Wed, 17 Feb 2010 00:57:44 +0100,
Giuliano Pochini wrote:
> 
> (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.
> 
> 
> Signed-off-by: Giuliano Pochini <pochini@shiny.it>

Applied now.  Thanks.


Takashi

> --- alsa-driver-1.0.22.1/alsa-kernel/pci/echoaudio/echoaudio.c__orig	2010-02-16 22:21:36.000000000 +0100
> +++ alsa-driver-1.0.22.1/alsa-kernel/pci/echoaudio/echoaudio.c	2010-02-16 22:21:45.000000000 +0100
> @@ -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]) {
> 
> 
> -- 
> Giuliano.
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-17 13:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-16 23:57 [PATCH] Echoaudio, fix Guru Meditation #00000005.48454C50 Giuliano Pochini
2010-02-17 13:50 ` Takashi Iwai

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).