diff mbox

[Lucid,2/3] SRU: Staging: comedi: usbdux.c: fix locking up of the driver when the comedi ringbuffer runs empty

Message ID 1271438730.30561.125.camel@emiko
State Accepted
Delegated to: Andy Whitcroft
Headers show

Commit Message

Leann Ogasawara April 16, 2010, 5:25 p.m. UTC
>From 1b810f3bc20af60ff312a03828b1572b412afc2b Mon Sep 17 00:00:00 2001
From: Bernd Porr <berndporr@f2s.com>
Date: Fri, 27 Nov 2009 12:00:53 +0000
Subject: [PATCH 2/3] Staging: comedi: usbdux.c: fix locking up of the driver when the comedi ringbuffer runs empty

BugLink: http://bugs.launchpad.net/bugs/483343

Jan-Matthias Braun spotted a bug which locks up the driver when the
comedi ring buffer runs empty and provided a patch. The driver would
still send the data to comedi but the reader won't wake up any more.
What's required is setting the flag COMEDI_CB_BLOCK after new data has
arrived which wakes up the reader and therefore the read() command.

Signed-off-by: Bernd Porr <berndporr@f2s.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

(cherry picked from commit d4c3a56587af3edbe5f618b20e800e9f9fde13cb upstream)

Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
---
 drivers/staging/comedi/drivers/usbdux.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Comments

Andy Whitcroft April 16, 2010, 6:12 p.m. UTC | #1
On Fri, Apr 16, 2010 at 10:25:30AM -0700, Leann Ogasawara wrote:
> >From 1b810f3bc20af60ff312a03828b1572b412afc2b Mon Sep 17 00:00:00 2001
> From: Bernd Porr <berndporr@f2s.com>
> Date: Fri, 27 Nov 2009 12:00:53 +0000
> Subject: [PATCH 2/3] Staging: comedi: usbdux.c: fix locking up of the driver when the comedi ringbuffer runs empty
> 
> BugLink: http://bugs.launchpad.net/bugs/483343
> 
> Jan-Matthias Braun spotted a bug which locks up the driver when the
> comedi ring buffer runs empty and provided a patch. The driver would
> still send the data to comedi but the reader won't wake up any more.
> What's required is setting the flag COMEDI_CB_BLOCK after new data has
> arrived which wakes up the reader and therefore the read() command.
> 
> Signed-off-by: Bernd Porr <berndporr@f2s.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
> 
> (cherry picked from commit d4c3a56587af3edbe5f618b20e800e9f9fde13cb upstream)
> 
> Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
> ---
>  drivers/staging/comedi/drivers/usbdux.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c
> index a4a65b0..5c9c1bc 100644
> --- a/drivers/staging/comedi/drivers/usbdux.c
> +++ b/drivers/staging/comedi/drivers/usbdux.c
> @@ -1,4 +1,4 @@
> -#define DRIVER_VERSION "v2.3"
> +#define DRIVER_VERSION "v2.4"
>  #define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com"
>  #define DRIVER_DESC "Stirling/ITL USB-DUX -- Bernd.Porr@f2s.com"
>  /*
> @@ -81,6 +81,8 @@ sampling rate. If you sample two channels you get 4kHz and so on.
>   * 2.1:  changed PWM API
>   * 2.2:  added firmware kernel request to fix an udev problem
>   * 2.3:  corrected a bug in bulk timeouts which were far too short
> + * 2.4:  fixed a bug which causes the driver to hang when it ran out of data.
> + *       Thanks to Jan-Matthias Braun and Ian to spot the bug and fix it.
>   *
>   */
>  
> @@ -532,6 +534,7 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb)
>  		}
>  	}
>  	/* tell comedi that data is there */
> +	s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS;
>  	comedi_event(this_usbduxsub->comedidev, s);
>  }

Acked-by: Andy Whitcroft <apw@canonical.com>

-apw
Colin Ian King April 16, 2010, 8:58 p.m. UTC | #2
On Fri, 2010-04-16 at 10:25 -0700, Leann Ogasawara wrote:
> >From 1b810f3bc20af60ff312a03828b1572b412afc2b Mon Sep 17 00:00:00 2001
> From: Bernd Porr <berndporr@f2s.com>
> Date: Fri, 27 Nov 2009 12:00:53 +0000
> Subject: [PATCH 2/3] Staging: comedi: usbdux.c: fix locking up of the driver when the comedi ringbuffer runs empty
> 
> BugLink: http://bugs.launchpad.net/bugs/483343
> 
> Jan-Matthias Braun spotted a bug which locks up the driver when the
> comedi ring buffer runs empty and provided a patch. The driver would
> still send the data to comedi but the reader won't wake up any more.
> What's required is setting the flag COMEDI_CB_BLOCK after new data has
> arrived which wakes up the reader and therefore the read() command.
> 
> Signed-off-by: Bernd Porr <berndporr@f2s.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
> 
> (cherry picked from commit d4c3a56587af3edbe5f618b20e800e9f9fde13cb upstream)
> 
> Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
> ---
>  drivers/staging/comedi/drivers/usbdux.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c
> index a4a65b0..5c9c1bc 100644
> --- a/drivers/staging/comedi/drivers/usbdux.c
> +++ b/drivers/staging/comedi/drivers/usbdux.c
> @@ -1,4 +1,4 @@
> -#define DRIVER_VERSION "v2.3"
> +#define DRIVER_VERSION "v2.4"
>  #define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com"
>  #define DRIVER_DESC "Stirling/ITL USB-DUX -- Bernd.Porr@f2s.com"
>  /*
> @@ -81,6 +81,8 @@ sampling rate. If you sample two channels you get 4kHz and so on.
>   * 2.1:  changed PWM API
>   * 2.2:  added firmware kernel request to fix an udev problem
>   * 2.3:  corrected a bug in bulk timeouts which were far too short
> + * 2.4:  fixed a bug which causes the driver to hang when it ran out of data.
> + *       Thanks to Jan-Matthias Braun and Ian to spot the bug and fix it.
>   *
>   */
>  
> @@ -532,6 +534,7 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb)
>  		}
>  	}
>  	/* tell comedi that data is there */
> +	s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS;
>  	comedi_event(this_usbduxsub->comedidev, s);
>  }
>  
> -- 
> 1.7.0
> 
> 
OK - passes end of scan up to tell comedi data is available, looks sane.

Acked-by: Colin King <colin.king@canonical.com>
diff mbox

Patch

diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c
index a4a65b0..5c9c1bc 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -1,4 +1,4 @@ 
-#define DRIVER_VERSION "v2.3"
+#define DRIVER_VERSION "v2.4"
 #define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com"
 #define DRIVER_DESC "Stirling/ITL USB-DUX -- Bernd.Porr@f2s.com"
 /*
@@ -81,6 +81,8 @@  sampling rate. If you sample two channels you get 4kHz and so on.
  * 2.1:  changed PWM API
  * 2.2:  added firmware kernel request to fix an udev problem
  * 2.3:  corrected a bug in bulk timeouts which were far too short
+ * 2.4:  fixed a bug which causes the driver to hang when it ran out of data.
+ *       Thanks to Jan-Matthias Braun and Ian to spot the bug and fix it.
  *
  */
 
@@ -532,6 +534,7 @@  static void usbduxsub_ai_IsocIrq(struct urb *urb)
 		}
 	}
 	/* tell comedi that data is there */
+	s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS;
 	comedi_event(this_usbduxsub->comedidev, s);
 }