]> git.karo-electronics.de Git - karo-tx-linux.git/commit
USB: fix bug in initialization of interface minor numbers
authorAlan Stern <stern@rowland.harvard.edu>
Tue, 21 Sep 2010 19:01:53 +0000 (15:01 -0400)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Thu, 6 Jan 2011 23:08:07 +0000 (18:08 -0500)
commit0ae4cdf56fa6b9fb2c98083e54f77a19ca4717f4
tree5f48c9ad83e86ce0e389e723dcfc93c68be1e578
parent777e779591d10f4908361a439f4822aa0143470b
USB: fix bug in initialization of interface minor numbers

commit 0026e00523a85b90a92a93ddf6660939ecef3e54 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>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
drivers/usb/core/file.c
drivers/usb/core/message.c