linux-uconsole/drivers/usb/core
Alan Stern 4c499af625 USB: fix bug in initialization of interface minor numbers
commit 0026e00523 upstream.

Recent changes in the usbhid layer exposed a bug in usbcore.  If
CONFIG_USB_DYNAMIC_MINORS is enabled then an interface may be assigned
a minor number of 0.  However interfaces that aren't registered as USB
class devices also have their minor number set to 0, during
initialization.  As a result usb_find_interface() may return the
wrong interface, leading to a crash.

This patch (as1418) fixes the problem by initializing every
interface's minor number to -1.  It also cleans up the
usb_register_dev() function, which besides being somewhat awkwardly
written, does not unwind completely on all its error paths.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Philip J. Turmel <philip@turmel.org>
Tested-by: Gabriel Craciunescu <nix.or.die@googlemail.com>
Tested-by: Alex Riesen <raa.lkml@gmail.com>
Tested-by: Matthias Bayer <jackdachef@gmail.com>
CC: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-28 21:43:53 -07:00
..
buffer.c USB: pass mem_flags to dma_alloc_coherent 2009-04-23 14:15:28 -07:00
config.c USB: Fix SS endpoint companion descriptor parsing. 2009-09-23 06:46:18 -07:00
devices.c USB: Don't use GFP_KERNEL while we cannot reset a storage device 2010-01-25 10:49:31 -08:00
devio.c USB: fix usbfs regression 2010-04-01 15:58:31 -07:00
driver.c USB: obey the sysfs power/wakeup setting 2010-08-02 10:21:03 -07:00
endpoint.c driver model: constify attribute groups 2009-09-15 09:50:47 -07:00
file.c USB: fix bug in initialization of interface minor numbers 2010-10-28 21:43:53 -07:00
generic.c USB: don't choose configs with no interfaces 2010-05-12 14:57:02 -07:00
hcd-pci.c USB: new flag for resume-from-hibernation 2009-06-15 21:44:44 -07:00
hcd.c USB: fix the idProduct value for USB-3.0 root hubs 2010-03-15 08:50:08 -07:00
hcd.h USB: Move hcd free_dev call into usb_disconnect to fix oops 2010-03-15 08:50:09 -07:00
hub.c USB delay init quirk for logitech Harmony 700-series devices 2010-08-13 13:19:42 -07:00
hub.h USB: fix the clear_tt_buffer interface 2009-07-12 15:16:38 -07:00
inode.c USB: fix testing the wrong variable in fs_create_by_name() 2010-05-12 14:57:02 -07:00
Kconfig Revert USB: usbfs: deprecate and hide option for !embedded 2009-07-12 15:16:39 -07:00
Makefile USB: add the usbfs devices file to debugfs 2009-06-15 21:44:43 -07:00
message.c USB: fix bug in initialization of interface minor numbers 2010-10-28 21:43:53 -07:00
notify.c USB : correct comments in usb/core/notify.c 2008-02-01 14:34:44 -08:00
otg_whitelist.h USB: fix codingstyle issues in drivers/usb/core/*.h 2008-02-01 14:35:07 -08:00
quirks.c USB delay init quirk for logitech Harmony 700-series devices 2010-08-13 13:19:42 -07:00
sysfs.c USB: add speed values for USB 3.0 and wireless controllers 2010-01-25 10:49:34 -08:00
urb.c USB: fix thread-unsafe anchor utiliy routines 2010-08-13 13:19:46 -07:00
usb.c USB: Move hcd free_dev call into usb_disconnect to fix oops 2010-03-15 08:50:09 -07:00
usb.h USB: add API for userspace drivers to "claim" ports 2009-09-23 06:46:22 -07:00