usb: gadget: composite: correctly initialize ep->maxpacket
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Wed, 28 Sep 2016 07:38:11 +0000 (10:38 +0300)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 16 Mar 2017 02:18:24 +0000 (02:18 +0000)
commit51d0c3514660c00e93b2b33076f162e9da217865
tree140f9c27057d4ffcdd32f92e0718a92de5abedce
parent436b6ffdc27c5f596e32b3166422a783a0c2ef8d
usb: gadget: composite: correctly initialize ep->maxpacket

commit e8f29bb719b47a234f33b0af62974d7a9521a52c upstream.

usb_endpoint_maxp() returns wMaxPacketSize in its
raw form. Without taking into consideration that it
also contains other bits reserved for isochronous
endpoints.

This patch fixes one occasion where this is a
problem by making sure that we initialize
ep->maxpacket only with lower 10 bits of the value
returned by usb_endpoint_maxp(). Note that seperate
patches will be necessary to audit all call sites of
usb_endpoint_maxp() and make sure that
usb_endpoint_maxp() only returns lower 10 bits of
wMaxPacketSize.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/usb/gadget/composite.c