]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
USB: usb_get_string should check the descriptor type
authorAlan Stern <stern@rowland.harvard.edu>
Fri, 20 Feb 2009 21:33:08 +0000 (16:33 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Mar 2009 00:32:03 +0000 (17:32 -0700)
commit2ad66518a8fc1cef4968bbe2fd65f37d9a177dd1
tree91a67f546422daae708edebd986f8336f0654ff0
parent8ad59c65f7e043b34f8bc83a1e5f8cb6796c22be
USB: usb_get_string should check the descriptor type

commit 67f5a4ba9741fcef3f4db3509ad03565d9e33af2 upstream.

This patch (as1218) fixes a problem with a radio-control joystick used
in the "walkera 4#3" helicopter.  This device responds to the initial
Get-String-Descriptor request for string 0 (which is really the list
of supported languages) by sending its config descriptor!  The
usb_get_string() routine needs to check whether it got the right
type of descriptor.

Oddly enough, this sort of check is already present in
usb_get_descriptor().  The patch changes the error code from -EPROTO
to -ENODATA, because -EPROTO shows up in so many other contexts to
indicate a hardware failure rather than a firmware error.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Guillermo Jarabo <williamjap@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/message.c