Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6:
USB: don't use reset-resume if drivers don't support it
USB: isp1760: Assign resource fields before adding hcd
isight_firmware: Avoid crash on loading invalid firmware
USB: fix build bug in USB_ISIGHTFW

+65 -13
+44 -2
drivers/usb/core/hub.c
··· 644 644 645 645 #ifdef CONFIG_PM 646 646 647 + /* Try to identify which devices need USB-PERSIST handling */ 648 + static int persistent_device(struct usb_device *udev) 649 + { 650 + int i; 651 + int retval; 652 + struct usb_host_config *actconfig; 653 + 654 + /* Explicitly not marked persistent? */ 655 + if (!udev->persist_enabled) 656 + return 0; 657 + 658 + /* No active config? */ 659 + actconfig = udev->actconfig; 660 + if (!actconfig) 661 + return 0; 662 + 663 + /* FIXME! We should check whether it's open here or not! */ 664 + 665 + /* 666 + * Check that all the interface drivers have a 667 + * 'reset_resume' entrypoint 668 + */ 669 + retval = 0; 670 + for (i = 0; i < actconfig->desc.bNumInterfaces; i++) { 671 + struct usb_interface *intf; 672 + struct usb_driver *driver; 673 + 674 + intf = actconfig->interface[i]; 675 + if (!intf->dev.driver) 676 + continue; 677 + driver = to_usb_driver(intf->dev.driver); 678 + if (!driver->reset_resume) 679 + return 0; 680 + /* 681 + * We have at least one driver, and that one 682 + * has a reset_resume method. 683 + */ 684 + retval = 1; 685 + } 686 + return retval; 687 + } 688 + 647 689 static void hub_restart(struct usb_hub *hub, int type) 648 690 { 649 691 struct usb_device *hdev = hub->hdev; ··· 731 689 * turn off the various status changes to prevent 732 690 * khubd from disconnecting it later. 733 691 */ 734 - if (udev->persist_enabled && status == 0 && 735 - !(portstatus & USB_PORT_STAT_ENABLE)) { 692 + if (status == 0 && !(portstatus & USB_PORT_STAT_ENABLE) && 693 + persistent_device(udev)) { 736 694 if (portchange & USB_PORT_STAT_C_ENABLE) 737 695 clear_port_feature(hub->hdev, port1, 738 696 USB_PORT_FEAT_C_ENABLE);
+4 -4
drivers/usb/host/isp1760-hcd.c
··· 2207 2207 goto err_put; 2208 2208 } 2209 2209 2210 - ret = usb_add_hcd(hcd, irq, irqflags); 2211 - if (ret) 2212 - goto err_unmap; 2213 - 2214 2210 hcd->irq = irq; 2215 2211 hcd->rsrc_start = res_start; 2216 2212 hcd->rsrc_len = res_len; 2213 + 2214 + ret = usb_add_hcd(hcd, irq, irqflags); 2215 + if (ret) 2216 + goto err_unmap; 2217 2217 2218 2218 return hcd; 2219 2219
+1
drivers/usb/misc/Kconfig
··· 272 272 config USB_ISIGHTFW 273 273 tristate "iSight firmware loading support" 274 274 depends on USB 275 + select FW_LOADER 275 276 help 276 277 This driver loads firmware for USB Apple iSight cameras, allowing 277 278 them to be driven by the USB video class driver available at
+16 -7
drivers/usb/misc/isight_firmware.c
··· 39 39 struct usb_device *dev = interface_to_usbdev(intf); 40 40 int llen, len, req, ret = 0; 41 41 const struct firmware *firmware; 42 - unsigned char *buf; 42 + unsigned char *buf = kmalloc(50, GFP_KERNEL); 43 43 unsigned char data[4]; 44 - char *ptr; 44 + u8 *ptr; 45 + 46 + if (!buf) 47 + return -ENOMEM; 45 48 46 49 if (request_firmware(&firmware, "isight.fw", &dev->dev) != 0) { 47 50 printk(KERN_ERR "Unable to load isight firmware\n"); ··· 62 59 goto out; 63 60 } 64 61 65 - while (1) { 62 + while (ptr+4 <= firmware->data+firmware->size) { 66 63 memcpy(data, ptr, 4); 67 64 len = (data[0] << 8 | data[1]); 68 65 req = (data[2] << 8 | data[3]); ··· 74 71 continue; 75 72 76 73 for (; len > 0; req += 50) { 77 - llen = len > 50 ? 50 : len; 74 + llen = min(len, 50); 78 75 len -= llen; 79 - 80 - buf = kmalloc(llen, GFP_KERNEL); 76 + if (ptr+llen > firmware->data+firmware->size) { 77 + printk(KERN_ERR 78 + "Malformed isight firmware"); 79 + ret = -ENODEV; 80 + goto out; 81 + } 81 82 memcpy(buf, ptr, llen); 82 83 83 84 ptr += llen; ··· 96 89 goto out; 97 90 } 98 91 99 - kfree(buf); 100 92 } 101 93 } 94 + 102 95 if (usb_control_msg 103 96 (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, "\0", 1, 104 97 300) != 1) { 105 98 printk(KERN_ERR "isight firmware loading completion failed\n"); 106 99 ret = -ENODEV; 107 100 } 101 + 108 102 out: 103 + kfree(buf); 109 104 release_firmware(firmware); 110 105 return ret; 111 106 }