mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
USB: don't register endpoints for interfaces that are going away
This patch (as1155) fixes a bug in usbcore. When interfaces are deleted, either because the device was disconnected or because of a configuration change, the extra attribute files and child endpoint devices may get left behind. This is because the core removes them before calling device_del(). But during device_del(), after the driver is unbound the core will reinstall altsetting 0 and recreate those extra attributes and children. The patch prevents this by adding a flag to record when the interface is in the midst of being unregistered. When the flag is set, the attribute files and child devices will not be created. Signed-off-by: Alan Stern <[email protected]> Cc: stable <[email protected]> [2.6.27, 2.6.26, 2.6.25] Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
0047ca0a45
commit
352d026338
3 changed files with 4 additions and 1 deletions
|
|
@ -1091,6 +1091,7 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
|
|||
continue;
|
||||
dev_dbg(&dev->dev, "unregistering interface %s\n",
|
||||
dev_name(&interface->dev));
|
||||
interface->unregistering = 1;
|
||||
usb_remove_sysfs_intf_files(interface);
|
||||
device_del(&interface->dev);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -840,7 +840,7 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf)
|
|||
struct usb_host_interface *alt = intf->cur_altsetting;
|
||||
int retval;
|
||||
|
||||
if (intf->sysfs_files_created)
|
||||
if (intf->sysfs_files_created || intf->unregistering)
|
||||
return 0;
|
||||
|
||||
/* The interface string may be present in some altsettings
|
||||
|
|
|
|||
Loading…
Reference in a new issue