Skip to content

Commit e8f29bb

Browse files
author
Felipe Balbi
committed
usb: gadget: composite: correctly initialize ep->maxpacket
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. Cc: <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 541b6fe commit e8f29bb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/usb/gadget/composite.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ int config_ep_by_speed(struct usb_gadget *g,
197197

198198
ep_found:
199199
/* commit results */
200-
_ep->maxpacket = usb_endpoint_maxp(chosen_desc);
200+
_ep->maxpacket = usb_endpoint_maxp(chosen_desc) & 0x7ff;
201201
_ep->desc = chosen_desc;
202202
_ep->comp_desc = NULL;
203203
_ep->maxburst = 0;

0 commit comments

Comments
 (0)