Skip to contentSkip to conversation

usb/gadget: Fix "high bandwidth" check in usb_gadget_ep_match_desc()

PATCH New Benjamin Herrenschmidt 1 participant 1 message Jan 12, 2018 USB

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 usb/gadget: Fix "high bandwidth" check in usb_gadget_ep_match_desc()

Quoted 10 lines · Alan Stern
Quoted 6 lines · Benjamin Herrenschmidt

The current code tries to test for bits that are masked out by usb_endpoint_maxp(). Instead, use the proper accessor to access the new high bandwidth bits.

---

Shouldn't this fix be queued for the stable kernels too?

Not sure, I'll let you decide. I noticed that by code inspection ages ago, and posted the fix at least 2 or 3 times already but nobody picked it up so I left it in my series and keep re-posting it :-) The bug doesn't actually affect me.

Cheers,
Ben.

Quoted 12 lines

Alan Stern

Quoted 10 lines
 drivers/usb/gadget/udc/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/core.c +0 -0
index 1b3efb14aec7..ac0541529499 100644
@@ -912,7 +912,7 @@ int usb_gadget_ep_match_desc(struct usb_gadget *gadget,
              return 0;
 
Quoted 6 lines

drivers/usb/gadget/udc/core.c int usb_gadget_ep_match_desc(struct usb_gadget *gadget, · line 918

Quoted 6 lines
drivers/usb/gadget/udc/core.c +1 -1
      /* "high bandwidth" works only at high speed */
-     if (!gadget_is_dualspeed(gadget) && usb_endpoint_maxp(desc) & (3<<11))
+     if (!gadget_is_dualspeed(gadget) && usb_endpoint_maxp_mult(desc) > 1)
              return 0;
 
      switch (type) {

---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html