]> git.karo-electronics.de Git - karo-tx-linux.git/commit
usb: rh_call_control tbuf overflow fix
authorSean O. Stalley <sean.stalley@intel.com>
Tue, 13 Aug 2013 17:36:12 +0000 (10:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Aug 2013 19:18:26 +0000 (12:18 -0700)
commite57e780b346a7277fdd3bde765d9d8728b99bfa1
treecf70344525eaab31cc6798d61da2f9c4ea3ee785
parent726a85caa30201eaadb993397a3e8ec23949c608
usb: rh_call_control tbuf overflow fix

rh_call_control() contains a buffer, tbuf, which it uses to hold
USB descriptors. These discriptors are eventually copied into the
transfer_buffer in the URB. The buffer in the URB is dynamically
defined and is always large enough to hold the amount of data it
requests.

tbuf is currently statically allocated on the stack with a size
of 15 bytes, regardless of the size specified in the URB.
This patch dynamically allocates tbuf, and ensures that tbuf is
at least as big as the buffer in the URB.

If an hcd attempts to write a descriptor containing more than
15 bytes ( such as the Standard BOS Descriptor for hubs, defined
in the USB3.0 Spec, section 10.13.1 ) the write would overflow
the buffer and corrupt the stack. This patch addresses this
behavior.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Sean O. Stalley <sean.stalley@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hcd.c