[Precise PATCH] USB: Fix 'bad dma' problem on WDM device disconnect

Leann Ogasawara leann.ogasawara at canonical.com
Wed Dec 12 17:29:26 UTC 2012


Hi Ming,

I'm a little confused here.  This patch was included upstream as of 2.6.39:

~/linux$ git show 878b753e32ca765cd346a5d3038d630178ec78ff
commit 878b753e32ca765cd346a5d3038d630178ec78ff
Author: Robert Lukassen <Robert.Lukassen at tomtom.com>
Date:   Wed Mar 16 12:13:34 2011 +0100

    USB: Fix 'bad dma' problem on WDM device disconnect

~/linux$ git describe --contains 878b753e32ca765cd346a5d3038d630178ec78ff
v2.6.39-rc1~85^2~3

Thus, this patch is already available in Precise by default.  Am I
missing something here?  Have you tested with a stock Precise kernel?

Thanks,
Leann

On 12/12/2012 07:04 AM, Ming Lei wrote:
> From: Robert Lukassen <Robert.Lukassen at tomtom.com>
>
> In the WDM class driver a disconnect event leads to calls to
> usb_free_coherent to put back two USB DMA buffers allocated earlier.
> The call to usb_free_coherent uses a different size parameter
> (desc->wMaxCommand) than the corresponding call to usb_alloc_coherent
> (desc->bMaxPacketSize0).
>
> When a disconnect event occurs, this leads to 'bad dma' complaints
> from usb core because the USB DMA buffer is being pushed back to the
> 'buffer-2048' pool from which it has not been allocated.
>
> This patch against the most recent linux-2.6 kernel ensures that the
> parameters used by usb_alloc_coherent & usb_free_coherent calls in
> cdc-wdm.c match.
>
> Looks this patch on stable tree is missed in precise release.
>
> BugLink: https://bugs.launchpad.net/bugs/1081879
>
> Signed-off-by: Robert Lukassen <robert.lukassen at tomtom.com>
> Cc: stable <stable at kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
> Signed-off-by: Ming Lei <ming.lei at canonical.com>
> ---
>  drivers/usb/class/cdc-wdm.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
> index 47085e5..a97c018 100644
> --- a/drivers/usb/class/cdc-wdm.c
> +++ b/drivers/usb/class/cdc-wdm.c
> @@ -281,7 +281,7 @@ static void cleanup(struct wdm_device *desc)
>  			  desc->sbuf,
>  			  desc->validity->transfer_dma);
>  	usb_free_coherent(interface_to_usbdev(desc->intf),
> -			  desc->wMaxCommand,
> +			  desc->bMaxPacketSize0,
>  			  desc->inbuf,
>  			  desc->response->transfer_dma);
>  	kfree(desc->orq);





More information about the kernel-team mailing list