提交 8e493ca1 编写于 作者: J Johan Hovold 提交者: Greg Kroah-Hartman

USB: usb_wwan: fix bulk-urb allocation

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: NDan Carpenter <dan.carpenter@oracle.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: NJohan Hovold <jhovold@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 169b245a
...@@ -455,9 +455,6 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port, ...@@ -455,9 +455,6 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial;
struct urb *urb; struct urb *urb;
if (endpoint == -1)
return NULL; /* endpoint not needed */
urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */
if (urb == NULL) { if (urb == NULL) {
dev_dbg(&serial->interface->dev, dev_dbg(&serial->interface->dev,
...@@ -489,6 +486,9 @@ int usb_wwan_port_probe(struct usb_serial_port *port) ...@@ -489,6 +486,9 @@ int usb_wwan_port_probe(struct usb_serial_port *port)
init_usb_anchor(&portdata->delayed); init_usb_anchor(&portdata->delayed);
for (i = 0; i < N_IN_URB; i++) { for (i = 0; i < N_IN_URB; i++) {
if (!port->bulk_in_size)
break;
buffer = (u8 *)__get_free_page(GFP_KERNEL); buffer = (u8 *)__get_free_page(GFP_KERNEL);
if (!buffer) if (!buffer)
goto bail_out_error; goto bail_out_error;
...@@ -502,8 +502,8 @@ int usb_wwan_port_probe(struct usb_serial_port *port) ...@@ -502,8 +502,8 @@ int usb_wwan_port_probe(struct usb_serial_port *port)
} }
for (i = 0; i < N_OUT_URB; i++) { for (i = 0; i < N_OUT_URB; i++) {
if (port->bulk_out_endpointAddress == -1) if (!port->bulk_out_size)
continue; break;
buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL); buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL);
if (!buffer) if (!buffer)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册