diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2008-10-29 15:16:58 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-11-13 17:45:00 -0500 |
commit | 352d026338378b1f13f044e33c1047da6e470056 (patch) | |
tree | 92e178cc234bfd19f15e8623b1b92d21918cb3fa /drivers/usb/core | |
parent | 0047ca0a45c6a481abd467fb52d2a480ffc8c6b9 (diff) |
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 <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org> [2.6.27, 2.6.26, 2.6.25]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/message.c | 1 | ||||
-rw-r--r-- | drivers/usb/core/sysfs.c | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 887738577b28..6d1048faf08e 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1091,6 +1091,7 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
1091 | continue; | 1091 | continue; |
1092 | dev_dbg(&dev->dev, "unregistering interface %s\n", | 1092 | dev_dbg(&dev->dev, "unregistering interface %s\n", |
1093 | dev_name(&interface->dev)); | 1093 | dev_name(&interface->dev)); |
1094 | interface->unregistering = 1; | ||
1094 | usb_remove_sysfs_intf_files(interface); | 1095 | usb_remove_sysfs_intf_files(interface); |
1095 | device_del(&interface->dev); | 1096 | device_del(&interface->dev); |
1096 | } | 1097 | } |
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index f66fba11fbd5..4fb65fdc9dc3 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -840,7 +840,7 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf) | |||
840 | struct usb_host_interface *alt = intf->cur_altsetting; | 840 | struct usb_host_interface *alt = intf->cur_altsetting; |
841 | int retval; | 841 | int retval; |
842 | 842 | ||
843 | if (intf->sysfs_files_created) | 843 | if (intf->sysfs_files_created || intf->unregistering) |
844 | return 0; | 844 | return 0; |
845 | 845 | ||
846 | /* The interface string may be present in some altsettings | 846 | /* The interface string may be present in some altsettings |