linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v3,1/3] usb/gadget: Fix "high bandwidth" check in usb_gadget_ep_match_desc()
@ 2018-01-12 22:31 Benjamin Herrenschmidt
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2018-01-12 22:31 UTC (permalink / raw)
  To: Alan Stern; +Cc: linux-usb, Greg KH, Joel Stanley, Andrew Jeffery

On Fri, 2018-01-12 at 10:53 -0500, Alan Stern wrote:
> On Fri, 12 Jan 2018, Benjamin Herrenschmidt wrote:
> 
> > 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.
> > 
> > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > ---
> 
> 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.

> Alan Stern
> 
> >  drivers/usb/gadget/udc/core.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> > index 1b3efb14aec7..ac0541529499 100644
> > --- a/drivers/usb/gadget/udc/core.c
> > +++ b/drivers/usb/gadget/udc/core.c
> > @@ -912,7 +912,7 @@ int usb_gadget_ep_match_desc(struct usb_gadget *gadget,
> >               return 0;
> >  
> >       /* "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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [v3,1/3] usb/gadget: Fix "high bandwidth" check in usb_gadget_ep_match_desc()
@ 2018-01-12 15:53 Alan Stern
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Stern @ 2018-01-12 15:53 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linux-usb, Greg KH, Joel Stanley, Andrew Jeffery

On Fri, 12 Jan 2018, Benjamin Herrenschmidt wrote:

> 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.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---

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

Alan Stern

>  drivers/usb/gadget/udc/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> index 1b3efb14aec7..ac0541529499 100644
> --- a/drivers/usb/gadget/udc/core.c
> +++ b/drivers/usb/gadget/udc/core.c
> @@ -912,7 +912,7 @@ int usb_gadget_ep_match_desc(struct usb_gadget *gadget,
>  		return 0;
>  
>  	/* "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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [v3,1/3] usb/gadget: Fix "high bandwidth" check in usb_gadget_ep_match_desc()
@ 2018-01-12  6:50 Benjamin Herrenschmidt
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2018-01-12  6:50 UTC (permalink / raw)
  To: linux-usb; +Cc: Greg KH, Joel Stanley, Andrew Jeffery, 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.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 drivers/usb/gadget/udc/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
index 1b3efb14aec7..ac0541529499 100644
--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -912,7 +912,7 @@ int usb_gadget_ep_match_desc(struct usb_gadget *gadget,
 		return 0;
 
 	/* "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) {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-12 22:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-12 22:31 [v3,1/3] usb/gadget: Fix "high bandwidth" check in usb_gadget_ep_match_desc() Benjamin Herrenschmidt
  -- strict thread matches above, loose matches on Subject: below --
2018-01-12 15:53 Alan Stern
2018-01-12  6:50 Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).