From patchwork Fri Dec 7 16:04:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herton Ronaldo Krzesinski X-Patchwork-Id: 204536 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 613282C0172 for ; Sat, 8 Dec 2012 03:04:38 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Th0Pe-0007eb-KU; Fri, 07 Dec 2012 16:04:30 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Th0Pb-0007dJ-Ui for kernel-team@lists.ubuntu.com; Fri, 07 Dec 2012 16:04:27 +0000 Received: from 200.146.81.152.dynamic.adsl.gvt.net.br ([200.146.81.152] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Th0PZ-0008BE-R2; Fri, 07 Dec 2012 16:04:26 +0000 From: Herton Ronaldo Krzesinski To: Johan Hovold Subject: [ 3.5.y.z extended stable ] Patch "USB: usb_wwan: fix bulk-urb allocation" has been added to staging queue Date: Fri, 7 Dec 2012 14:04:22 -0200 Message-Id: <1354896262-21607-1-git-send-email-herton.krzesinski@canonical.com> X-Mailer: git-send-email 1.7.9.5 X-Extended-Stable: 3.5 Cc: Greg Kroah-Hartman , kernel-team@lists.ubuntu.com, Dan Carpenter X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com This is a note to let you know that I have just added a patch titled USB: usb_wwan: fix bulk-urb allocation to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree which can be found at: http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue If you, or anyone else, feels it should not be added to this tree, please reply to this email. For more information about the 3.5.y.z tree, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable Thanks. -Herton ------ From 3afe447b6da0a76d40119b431778150445c7ff66 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Fri, 26 Oct 2012 18:44:20 +0200 Subject: [PATCH] USB: usb_wwan: fix bulk-urb allocation commit 8e493ca1767d4951ed1322abaa74d6edbca29918 upstream. Make sure we do not allocate urbs if we do not have a bulk endpoint. Legacy code used incorrect assumption to test for bulk endpoints. Reported-by: Dan Carpenter Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman [ herton: backport for 3.5: allocation splitted in attach (in usb_wwan_setup_urbs and usb_wwan_startup), so patch two locations with the size checking. ] Signed-off-by: Herton Ronaldo Krzesinski --- drivers/usb/serial/usb_wwan.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) -- 1.7.9.5 diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index f35971d..da28535 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -453,9 +453,6 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial *serial, int endpoint, { struct urb *urb; - if (endpoint == -1) - return NULL; /* endpoint not needed */ - urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ if (urb == NULL) { dbg("%s: alloc for endpoint %d failed.", __func__, endpoint); @@ -483,6 +480,9 @@ static void usb_wwan_setup_urbs(struct usb_serial *serial) /* Do indat endpoints first */ for (j = 0; j < N_IN_URB; ++j) { + if (!port->bulk_in_size) + break; + portdata->in_urbs[j] = usb_wwan_setup_urb(serial, port-> bulk_in_endpointAddress, @@ -496,6 +496,9 @@ static void usb_wwan_setup_urbs(struct usb_serial *serial) /* outdat endpoints */ for (j = 0; j < N_OUT_URB; ++j) { + if (!port->bulk_out_size) + break; + portdata->out_urbs[j] = usb_wwan_setup_urb(serial, port-> bulk_out_endpointAddress, @@ -529,6 +532,9 @@ int usb_wwan_startup(struct usb_serial *serial) init_usb_anchor(&portdata->delayed); for (j = 0; j < N_IN_URB; j++) { + if (!port->bulk_in_size) + break; + buffer = (u8 *) __get_free_page(GFP_KERNEL); if (!buffer) goto bail_out_error; @@ -536,6 +542,9 @@ int usb_wwan_startup(struct usb_serial *serial) } for (j = 0; j < N_OUT_URB; j++) { + if (!port->bulk_out_size) + break; + buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL); if (!buffer) goto bail_out_error2;