USB: fix bugs in usb_(de)authorize_device
commit526fed8b3c60bd7746de0df7676c83800c36b906
authorAlan Stern <stern@rowland.harvard.edu>
Tue, 8 Dec 2009 20:54:44 +0000 (8 15:54 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 6 Jan 2010 23:03:46 +0000 (6 15:03 -0800)
tree58beb7d4977b892c88d55eb5370d36195301911b
parentc6d7a67b493a4bc990a2c8155787ff70903a2335
USB: fix bugs in usb_(de)authorize_device

commit da307123c621b01cce147a4be313d8a754674f63 upstream.

This patch (as1315) fixes some bugs in the USB core authorization
code:

usb_deauthorize_device() should deallocate the device strings
instead of leaking them, and it should invoke
usb_destroy_configuration() (which does proper reference
counting) instead of freeing the config information directly.

usb_authorize_device() shouldn't change the device strings
until it knows that the authorization will succeed, and it should
autosuspend the device at the end (having autoresumed the
device at the start).

Because the device strings can be changed, the sysfs routines
to display the strings must protect the string pointers by
locking the device.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Acked-by: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/hub.c
drivers/usb/core/sysfs.c