diff options
author | Robert Lukassen <Robert.Lukassen@tomtom.com> | 2011-03-16 07:13:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-03-23 16:21:02 -0400 |
commit | 878b753e32ca765cd346a5d3038d630178ec78ff (patch) | |
tree | 0b72c2d333471c292d7b30ef675302f1205022df | |
parent | 97ac01d8f1b8d1c9e5af32c2813ba771835961f9 (diff) |
USB: Fix 'bad dma' problem on WDM device disconnect
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.
Signed-off-by: Robert Lukassen <robert.lukassen@tomtom.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/class/cdc-wdm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 47085e5879ab..a97c018dd419 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) | |||
281 | desc->sbuf, | 281 | desc->sbuf, |
282 | desc->validity->transfer_dma); | 282 | desc->validity->transfer_dma); |
283 | usb_free_coherent(interface_to_usbdev(desc->intf), | 283 | usb_free_coherent(interface_to_usbdev(desc->intf), |
284 | desc->wMaxCommand, | 284 | desc->bMaxPacketSize0, |
285 | desc->inbuf, | 285 | desc->inbuf, |
286 | desc->response->transfer_dma); | 286 | desc->response->transfer_dma); |
287 | kfree(desc->orq); | 287 | kfree(desc->orq); |