Skip to content

Commit 89cb9ae

Browse files
committed
Merge tag 'usb-3.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are some small USB fixes for 3.11-rc6 that have accumulated. Nothing huge, a EHCI fix that solves a much-reported audio USB problem, some usb-serial driver endian fixes and other minor fixes, a wireless USB oops fix, and two new quirks" * tag 'usb-3.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: USB: keyspan: fix null-deref at disconnect and release USB: mos7720: fix broken control requests usb: add two quirky touchscreen USB: ti_usb_3410_5052: fix big-endian firmware handling USB: adutux: fix big-endian device-type reporting USB: usbtmc: fix big-endian probe of Rigol devices USB: mos7840: fix big-endian probe USB-Serial: Fix error handling of usb_wwan wusbcore: fix kernel panic when disconnecting a wireless USB->serial device USB: EHCI: accept very late isochronous URBs
2 parents ddea368 + ff8a43c commit 89cb9ae

File tree

10 files changed

+55
-37
lines changed

10 files changed

+55
-37
lines changed

drivers/usb/class/usbtmc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,11 +1119,11 @@ static int usbtmc_probe(struct usb_interface *intf,
11191119
/* Determine if it is a Rigol or not */
11201120
data->rigol_quirk = 0;
11211121
dev_dbg(&intf->dev, "Trying to find if device Vendor 0x%04X Product 0x%04X has the RIGOL quirk\n",
1122-
data->usb_dev->descriptor.idVendor,
1123-
data->usb_dev->descriptor.idProduct);
1122+
le16_to_cpu(data->usb_dev->descriptor.idVendor),
1123+
le16_to_cpu(data->usb_dev->descriptor.idProduct));
11241124
for(n = 0; usbtmc_id_quirk[n].idVendor > 0; n++) {
1125-
if ((usbtmc_id_quirk[n].idVendor == data->usb_dev->descriptor.idVendor) &&
1126-
(usbtmc_id_quirk[n].idProduct == data->usb_dev->descriptor.idProduct)) {
1125+
if ((usbtmc_id_quirk[n].idVendor == le16_to_cpu(data->usb_dev->descriptor.idVendor)) &&
1126+
(usbtmc_id_quirk[n].idProduct == le16_to_cpu(data->usb_dev->descriptor.idProduct))) {
11271127
dev_dbg(&intf->dev, "Setting this device as having the RIGOL quirk\n");
11281128
data->rigol_quirk = 1;
11291129
break;

drivers/usb/core/quirks.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ static const struct usb_device_id usb_quirk_list[] = {
7878
{ USB_DEVICE(0x04d8, 0x000c), .driver_info =
7979
USB_QUIRK_CONFIG_INTF_STRINGS },
8080

81+
/* CarrolTouch 4000U */
82+
{ USB_DEVICE(0x04e7, 0x0009), .driver_info = USB_QUIRK_RESET_RESUME },
83+
84+
/* CarrolTouch 4500U */
85+
{ USB_DEVICE(0x04e7, 0x0030), .driver_info = USB_QUIRK_RESET_RESUME },
86+
8187
/* Samsung Android phone modem - ID conflict with SPH-I500 */
8288
{ USB_DEVICE(0x04e8, 0x6601), .driver_info =
8389
USB_QUIRK_CONFIG_INTF_STRINGS },

drivers/usb/host/ehci-sched.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,21 +1391,20 @@ iso_stream_schedule (
13911391

13921392
/* Behind the scheduling threshold? */
13931393
if (unlikely(start < next)) {
1394+
unsigned now2 = (now - base) & (mod - 1);
13941395

13951396
/* USB_ISO_ASAP: Round up to the first available slot */
13961397
if (urb->transfer_flags & URB_ISO_ASAP)
13971398
start += (next - start + period - 1) & -period;
13981399

13991400
/*
1400-
* Not ASAP: Use the next slot in the stream. If
1401-
* the entire URB falls before the threshold, fail.
1401+
* Not ASAP: Use the next slot in the stream,
1402+
* no matter what.
14021403
*/
1403-
else if (start + span - period < next) {
1404-
ehci_dbg(ehci, "iso urb late %p (%u+%u < %u)\n",
1404+
else if (start + span - period < now2) {
1405+
ehci_dbg(ehci, "iso underrun %p (%u+%u < %u)\n",
14051406
urb, start + base,
1406-
span - period, next + base);
1407-
status = -EXDEV;
1408-
goto fail;
1407+
span - period, now2 + base);
14091408
}
14101409
}
14111410

drivers/usb/misc/adutux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ static int adu_probe(struct usb_interface *interface,
830830

831831
/* let the user know what node this device is now attached to */
832832
dev_info(&interface->dev, "ADU%d %s now attached to /dev/usb/adutux%d\n",
833-
udev->descriptor.idProduct, dev->serial_number,
833+
le16_to_cpu(udev->descriptor.idProduct), dev->serial_number,
834834
(dev->minor - ADU_MINOR_BASE));
835835
exit:
836836
dbg(2, " %s : leave, return value %p (dev)", __func__, dev);

drivers/usb/serial/keyspan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2303,7 +2303,7 @@ static int keyspan_startup(struct usb_serial *serial)
23032303
if (d_details == NULL) {
23042304
dev_err(&serial->dev->dev, "%s - unknown product id %x\n",
23052305
__func__, le16_to_cpu(serial->dev->descriptor.idProduct));
2306-
return 1;
2306+
return -ENODEV;
23072307
}
23082308

23092309
/* Setup private data for serial driver */

drivers/usb/serial/mos7720.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ struct urbtracker {
9090
struct list_head urblist_entry;
9191
struct kref ref_count;
9292
struct urb *urb;
93+
struct usb_ctrlrequest *setup;
9394
};
9495

9596
enum mos7715_pp_modes {
@@ -271,6 +272,7 @@ static void destroy_urbtracker(struct kref *kref)
271272
struct mos7715_parport *mos_parport = urbtrack->mos_parport;
272273

273274
usb_free_urb(urbtrack->urb);
275+
kfree(urbtrack->setup);
274276
kfree(urbtrack);
275277
kref_put(&mos_parport->ref_count, destroy_mos_parport);
276278
}
@@ -355,7 +357,6 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,
355357
struct urbtracker *urbtrack;
356358
int ret_val;
357359
unsigned long flags;
358-
struct usb_ctrlrequest setup;
359360
struct usb_serial *serial = mos_parport->serial;
360361
struct usb_device *usbdev = serial->dev;
361362

@@ -373,14 +374,20 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,
373374
kfree(urbtrack);
374375
return -ENOMEM;
375376
}
376-
setup.bRequestType = (__u8)0x40;
377-
setup.bRequest = (__u8)0x0e;
378-
setup.wValue = get_reg_value(reg, dummy);
379-
setup.wIndex = get_reg_index(reg);
380-
setup.wLength = 0;
377+
urbtrack->setup = kmalloc(sizeof(*urbtrack->setup), GFP_KERNEL);
378+
if (!urbtrack->setup) {
379+
usb_free_urb(urbtrack->urb);
380+
kfree(urbtrack);
381+
return -ENOMEM;
382+
}
383+
urbtrack->setup->bRequestType = (__u8)0x40;
384+
urbtrack->setup->bRequest = (__u8)0x0e;
385+
urbtrack->setup->wValue = get_reg_value(reg, dummy);
386+
urbtrack->setup->wIndex = get_reg_index(reg);
387+
urbtrack->setup->wLength = 0;
381388
usb_fill_control_urb(urbtrack->urb, usbdev,
382389
usb_sndctrlpipe(usbdev, 0),
383-
(unsigned char *)&setup,
390+
(unsigned char *)urbtrack->setup,
384391
NULL, 0, async_complete, urbtrack);
385392
kref_init(&urbtrack->ref_count);
386393
INIT_LIST_HEAD(&urbtrack->urblist_entry);

drivers/usb/serial/mos7840.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2193,7 +2193,7 @@ static int mos7810_check(struct usb_serial *serial)
21932193
static int mos7840_probe(struct usb_serial *serial,
21942194
const struct usb_device_id *id)
21952195
{
2196-
u16 product = serial->dev->descriptor.idProduct;
2196+
u16 product = le16_to_cpu(serial->dev->descriptor.idProduct);
21972197
u8 *buf;
21982198
int device_type;
21992199

drivers/usb/serial/ti_usb_3410_5052.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,14 +1536,15 @@ static int ti_download_firmware(struct ti_device *tdev)
15361536
char buf[32];
15371537

15381538
/* try ID specific firmware first, then try generic firmware */
1539-
sprintf(buf, "ti_usb-v%04x-p%04x.fw", dev->descriptor.idVendor,
1540-
dev->descriptor.idProduct);
1539+
sprintf(buf, "ti_usb-v%04x-p%04x.fw",
1540+
le16_to_cpu(dev->descriptor.idVendor),
1541+
le16_to_cpu(dev->descriptor.idProduct));
15411542
status = request_firmware(&fw_p, buf, &dev->dev);
15421543

15431544
if (status != 0) {
15441545
buf[0] = '\0';
1545-
if (dev->descriptor.idVendor == MTS_VENDOR_ID) {
1546-
switch (dev->descriptor.idProduct) {
1546+
if (le16_to_cpu(dev->descriptor.idVendor) == MTS_VENDOR_ID) {
1547+
switch (le16_to_cpu(dev->descriptor.idProduct)) {
15471548
case MTS_CDMA_PRODUCT_ID:
15481549
strcpy(buf, "mts_cdma.fw");
15491550
break;

drivers/usb/serial/usb_wwan.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -291,18 +291,18 @@ static void usb_wwan_indat_callback(struct urb *urb)
291291
tty_flip_buffer_push(&port->port);
292292
} else
293293
dev_dbg(dev, "%s: empty read urb received\n", __func__);
294-
295-
/* Resubmit urb so we continue receiving */
296-
err = usb_submit_urb(urb, GFP_ATOMIC);
297-
if (err) {
298-
if (err != -EPERM) {
299-
dev_err(dev, "%s: resubmit read urb failed. (%d)\n", __func__, err);
300-
/* busy also in error unless we are killed */
301-
usb_mark_last_busy(port->serial->dev);
302-
}
303-
} else {
294+
}
295+
/* Resubmit urb so we continue receiving */
296+
err = usb_submit_urb(urb, GFP_ATOMIC);
297+
if (err) {
298+
if (err != -EPERM) {
299+
dev_err(dev, "%s: resubmit read urb failed. (%d)\n",
300+
__func__, err);
301+
/* busy also in error unless we are killed */
304302
usb_mark_last_busy(port->serial->dev);
305303
}
304+
} else {
305+
usb_mark_last_busy(port->serial->dev);
306306
}
307307
}
308308

drivers/usb/wusbcore/wa-xfer.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,12 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb)
12261226
}
12271227
spin_lock_irqsave(&xfer->lock, flags);
12281228
rpipe = xfer->ep->hcpriv;
1229+
if (rpipe == NULL) {
1230+
pr_debug("%s: xfer id 0x%08X has no RPIPE. %s",
1231+
__func__, wa_xfer_id(xfer),
1232+
"Probably already aborted.\n" );
1233+
goto out_unlock;
1234+
}
12291235
/* Check the delayed list -> if there, release and complete */
12301236
spin_lock_irqsave(&wa->xfer_list_lock, flags2);
12311237
if (!list_empty(&xfer->list_node) && xfer->seg == NULL)
@@ -1644,8 +1650,7 @@ static void wa_xfer_result_cb(struct urb *urb)
16441650
break;
16451651
}
16461652
usb_status = xfer_result->bTransferStatus & 0x3f;
1647-
if (usb_status == WA_XFER_STATUS_ABORTED
1648-
|| usb_status == WA_XFER_STATUS_NOT_FOUND)
1653+
if (usb_status == WA_XFER_STATUS_NOT_FOUND)
16491654
/* taken care of already */
16501655
break;
16511656
xfer_id = xfer_result->dwTransferID;

0 commit comments

Comments
 (0)