diff mbox

[Oneiric/Precise,SRU] UBUNTU: SAUCE: usb: cdc-wdm: fix regression on buffer deallocation

Message ID 1355490720-5119-2-git-send-email-herton.krzesinski@canonical.com
State New
Headers show

Commit Message

Herton Ronaldo Krzesinski Dec. 14, 2012, 1:12 p.m. UTC
Commit cafbe85 ("USB: cdc-wdm: better allocate a buffer that is at least
as big as we tell the USB core") introduced a regression: it changed
the size used in usb_alloc_coherent, but failed to do the same for the
usb_free_coherent calls.

It also was marked for stable and got backported to older kernels. But
in the upstream kernel, the usage of usb_alloc_coherent was right after
removed from the driver, so upstream doesn't have this problem, while
the stable kernels still have. For now, just fix the usb_free_coherent
calls to match the usb_alloc_coherent change.

BugLink: https://bugs.launchpad.net/bugs/1074157
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/class/cdc-wdm.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Colin Ian King Dec. 14, 2012, 1:19 p.m. UTC | #1
On 14/12/12 13:12, Herton Ronaldo Krzesinski wrote:
> Commit cafbe85 ("USB: cdc-wdm: better allocate a buffer that is at least
> as big as we tell the USB core") introduced a regression: it changed
> the size used in usb_alloc_coherent, but failed to do the same for the
> usb_free_coherent calls.
>
> It also was marked for stable and got backported to older kernels. But
> in the upstream kernel, the usage of usb_alloc_coherent was right after
> removed from the driver, so upstream doesn't have this problem, while
> the stable kernels still have. For now, just fix the usb_free_coherent
> calls to match the usb_alloc_coherent change.
>
> BugLink: https://bugs.launchpad.net/bugs/1074157
> Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
> ---
>   drivers/usb/class/cdc-wdm.c |    4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
> index 9aaed0d..97b2c55 100644
> --- a/drivers/usb/class/cdc-wdm.c
> +++ b/drivers/usb/class/cdc-wdm.c
> @@ -301,7 +301,7 @@ static void cleanup(struct wdm_device *desc)
>   			  desc->sbuf,
>   			  desc->validity->transfer_dma);
>   	usb_free_coherent(interface_to_usbdev(desc->intf),
> -			  desc->bMaxPacketSize0,
> +			  desc->wMaxCommand,
>   			  desc->inbuf,
>   			  desc->response->transfer_dma);
>   	kfree(desc->orq);
> @@ -788,7 +788,7 @@ out:
>   err3:
>   	usb_set_intfdata(intf, NULL);
>   	usb_free_coherent(interface_to_usbdev(desc->intf),
> -			  desc->bMaxPacketSize0,
> +			  desc->wMaxCommand,
>   			desc->inbuf,
>   			desc->response->transfer_dma);
>   err2:
>

Acked-by: Colin Ian King <colin.king@canonical.com>
Ming Lei Dec. 18, 2012, 1:24 a.m. UTC | #2
On Fri, Dec 14, 2012 at 9:12 PM, Herton Ronaldo Krzesinski
<herton.krzesinski@canonical.com> wrote:
> Commit cafbe85 ("USB: cdc-wdm: better allocate a buffer that is at least
> as big as we tell the USB core") introduced a regression: it changed
> the size used in usb_alloc_coherent, but failed to do the same for the
> usb_free_coherent calls.
>
> It also was marked for stable and got backported to older kernels. But

Every stable tree which has merged the commit should be fixed by the patch too.

> in the upstream kernel, the usage of usb_alloc_coherent was right after
> removed from the driver, so upstream doesn't have this problem, while
> the stable kernels still have. For now, just fix the usb_free_coherent
> calls to match the usb_alloc_coherent change.
>
> BugLink: https://bugs.launchpad.net/bugs/1074157
> Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>

Acked-by: Ming Lei <ming.lei@canonical.com>

> ---
>  drivers/usb/class/cdc-wdm.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
> index 9aaed0d..97b2c55 100644
> --- a/drivers/usb/class/cdc-wdm.c
> +++ b/drivers/usb/class/cdc-wdm.c
> @@ -301,7 +301,7 @@ static void cleanup(struct wdm_device *desc)
>                           desc->sbuf,
>                           desc->validity->transfer_dma);
>         usb_free_coherent(interface_to_usbdev(desc->intf),
> -                         desc->bMaxPacketSize0,
> +                         desc->wMaxCommand,
>                           desc->inbuf,
>                           desc->response->transfer_dma);
>         kfree(desc->orq);
> @@ -788,7 +788,7 @@ out:
>  err3:
>         usb_set_intfdata(intf, NULL);
>         usb_free_coherent(interface_to_usbdev(desc->intf),
> -                         desc->bMaxPacketSize0,
> +                         desc->wMaxCommand,
>                         desc->inbuf,
>                         desc->response->transfer_dma);
>  err2:
> --
> 1.7.9.5
>
diff mbox

Patch

diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 9aaed0d..97b2c55 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -301,7 +301,7 @@  static void cleanup(struct wdm_device *desc)
 			  desc->sbuf,
 			  desc->validity->transfer_dma);
 	usb_free_coherent(interface_to_usbdev(desc->intf),
-			  desc->bMaxPacketSize0,
+			  desc->wMaxCommand,
 			  desc->inbuf,
 			  desc->response->transfer_dma);
 	kfree(desc->orq);
@@ -788,7 +788,7 @@  out:
 err3:
 	usb_set_intfdata(intf, NULL);
 	usb_free_coherent(interface_to_usbdev(desc->intf),
-			  desc->bMaxPacketSize0,
+			  desc->wMaxCommand,
 			desc->inbuf,
 			desc->response->transfer_dma);
 err2: