Hi,

There is a problem in stable kernels that included the commit cafbe85
("USB: cdc-wdm: better allocate a buffer that is at least as big as we
tell the USB core")

In that commit, the usb_alloc_coherent call was changed without also
adjusting usb_free_coherent calls. I got a report about it on
http://bugs.launchpad.net/bugs/1074157

But right after commit cafbe85, marked for stable, usb_alloc_coherent
was removed from the driver, so upstream is not affected by the issue,
while some stables are, the ones which included cafbe85, and one
solution must be considered for them.

My question is, should stables pick commit 8457d99, which removes the
usb_alloc_coherent usage and will also solve the bug for them, or may be
for example use the version below, which also makes clear why it isn't
taking an upstream commit:

From: Herton Ronaldo Krzesinski <[email protected]>
Date: Fri, 14 Dec 2012 10:38:02 -0200
Subject: [PATCH] USB: cdc-wdm: fix regression on buffer deallocation

[ no commit upstream, since usb_alloc_coherent usage was removed from
  the driver before this was fixed ]

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, and thus need this fix.

BugLink: https://bugs.launchpad.net/bugs/1074157
Signed-off-by: Herton Ronaldo Krzesinski <[email protected]>
---
 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

Please advise, ack and consider for inclusion one of the solutions in
all stable kernels which have commit cafbe85, but still uses
usb_alloc_coherent.

-- 
[]'s
Herton
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to