Skip to contentSkip to conversation

Patch "usb: gadget: composite: correctly initialize ep->maxpacket" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Jan 3, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

    usb: gadget: composite: correctly initialize ep->maxpacket

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
usb-gadget-composite-correctly-initialize-ep-maxpacket.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From e8f29bb719b47a234f33b0af62974d7a9521a52c Mon Sep 17 00:00:00 2001

From: Felipe Balbi <[email protected]>
Date: Wed, 28 Sep 2016 10:38:11 +0300
Subject: usb: gadget: composite: correctly initialize ep->maxpacket

From: Felipe Balbi <[email protected]>

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.

---
 drivers/usb/gadget/composite.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/composite.c +1 -1
@@ -144,7 +144,7 @@ int config_ep_by_speed(struct usb_gadget
 
 ep_found:
 	/* commit results */
-	_ep->maxpacket = usb_endpoint_maxp(chosen_desc);
+	_ep->maxpacket = usb_endpoint_maxp(chosen_desc) & 0x7ff;
 	_ep->desc = chosen_desc;
 	_ep->comp_desc = NULL;
 	_ep->maxburst = 0;

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/usb-gadget-composite-always-set-ep-mult-to-a-sensible-value.patch queue-4.4/usb-gadget-f_uac2-fix-error-handling-at-afunc_bind.patch queue-4.4/usb-gadget-composite-correctly-initialize-ep-maxpacket.patch