Welcome! Log In Create A New Profile

Advanced

[024/115] USB: prevent buggy hubs from crashing the USB stack

Posted by Greg KH 
2.6.32-longterm review patch. If anyone has any objections, please let us know.

------------------

From: Alan Stern <[email protected]>

commit d199c96d41d80a567493e12b8e96ea056a1350c1 upstream.

If anyone comes across a high-speed hub that (by mistake or by design)
claims to have no Transaction Translators, plugging a full- or
low-speed device into it will cause the USB stack to crash. This
patch (as1446) prevents the problem by ignoring such devices, since
the kernel has no way to communicate with them.

Signed-off-by: Alan Stern <[email protected]>
Tested-by: Perry Neben <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/usb/core/hub.c | 5 +++++
1 file changed, 5 insertions(+)

--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2683,6 +2683,11 @@ hub_port_init (struct usb_hub *hub, stru
udev->ttport = hdev->ttport;
} else if (udev->speed != USB_SPEED_HIGH
&& hdev->speed == USB_SPEED_HIGH) {
+ if (!hub->tt.hub) {
+ dev_err(&udev->dev, "parent hub has no TT\n");
+ retval = -EINVAL;
+ goto fail;
+ }
udev->tt = &hub->tt;
udev->ttport = port1;
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Alexander Holler
Re: [024/115] USB: prevent buggy hubs from crashing the USB stack
February 23, 2011 09:20AM
Am 16.02.2011 02:44, schrieb Greg KH:
> 2.6.32-longterm review patch. If anyone has any objections, please let us know.

This patch killed the MUSB-host-functionality here (on a BeagleBoard).

Regards,

Alexander


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Alexander Holler
Re: [024/115] USB: prevent buggy hubs from crashing the USB stack
February 23, 2011 09:50AM
Am 23.02.2011 09:06, schrieb Alexander Holler:
> Am 16.02.2011 02:44, schrieb Greg KH:
>> 2.6.32-longterm review patch. If anyone has any objections, please let
>> us know.
>
> This patch killed the MUSB-host-functionality here (on a BeagleBoard).

Sorry, haven't seen at first, that the question was for 2.6.32. I had to
revert this patch for 2.6.37.1. Without the revert I've got endless
messages that the "parent hub has no TT".

I've configured musb in gadget-mode and I'm loading g_zero to use a
bt-dongle attached to the OTG-(MUSB-)port.

> Regards,
>
> Alexander
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
On Wed, 23 Feb 2011, Alexander Holler wrote:

> Am 23.02.2011 09:06, schrieb Alexander Holler:
> > Am 16.02.2011 02:44, schrieb Greg KH:
> >> 2.6.32-longterm review patch. If anyone has any objections, please let
> >> us know.
> >
> > This patch killed the MUSB-host-functionality here (on a BeagleBoard).
>
> Sorry, haven't seen at first, that the question was for 2.6.32. I had to
> revert this patch for 2.6.37.1. Without the revert I've got endless
> messages that the "parent hub has no TT".
>
> I've configured musb in gadget-mode and I'm loading g_zero to use a
> bt-dongle attached to the OTG-(MUSB-)port.
>
> > Regards,
> >
> > Alexander

On Wed, 23 Feb 2011, Michael Jones wrote:

> Hi all,
>
> My OMAP37 board started choking on my USB mouse when I updated from
> 2.6.37 to 2.6.38rc5. I've tracked it down to commit
> d199c96d41d80a567493e12b8e96ea056a1350c1, "USB: prevent buggy hubs from
> crashing the USB stack." If I revert this commit, my mouse works again.
> Otherwise, I get the message:
>
> usb 1-1: new low speed USB device using musb-hdrc and address 33
> usb 1-1: parent hub has no TT
>
> repeatedly (with 'address' incrementing).
>
> I'm using the musb-hdrc driver for the OTG USB port in host mode.
>
> some relevant config:
> CONFIG_USB_EHCI_HCD_OMAP=y
> CONFIG_USB_MUSB_HDRC=y
> CONFIG_USB_MUSB_OMAP2PLUS=y
> CONFIG_USB_MUSB_HOST=y
> CONFIG_USB_MUSB_HDRC_HCD=y
> CONFIG_USB_INVENTRA_DMA=y
>
> # lsusb
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
>
> Any thoughts on how to get around this besides just reverting the
> commit? Did anybody already encounter this?
>
> thanks,
> Michael

In both cases, it appears that the problem is caused by the fact that
the musb host-controller driver doesn't set the hcd->has_tt flag.

Felipe, you should know where it belongs. It should be easy enough to
add.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Hi,

On Wed, Feb 23, 2011 at 10:26:20AM -0500, Alan Stern wrote:
> In both cases, it appears that the problem is caused by the fact that
> the musb host-controller driver doesn't set the hcd->has_tt flag.
>
> Felipe, you should know where it belongs. It should be easy enough to
> add.

Sure Alan, it's attached to this mail. Compile tested only though.
Michael, would you care to give your tested-by ?

--
balbi
Alexander Holler
Re: [024/115] USB: prevent buggy hubs from crashing the USB stack
February 24, 2011 10:20AM
Hello,

Am 24.02.2011 09:57, schrieb Felipe Balbi:
> Hi,
>
> On Wed, Feb 23, 2011 at 10:26:20AM -0500, Alan Stern wrote:
>> In both cases, it appears that the problem is caused by the fact that
>> the musb host-controller driver doesn't set the hcd->has_tt flag.
>>
>> Felipe, you should know where it belongs. It should be easy enough to
>> add.
>
> Sure Alan, it's attached to this mail. Compile tested only though.
> Michael, would you care to give your tested-by ?

I can do, I'm using exactly the same patch since yesterday. ;)

Tested-by: Alexander Holler <[email protected]>

Regards,

Alexander

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Hi,

On Thu, Feb 24, 2011 at 10:15:23AM +0100, Alexander Holler wrote:
> >On Wed, Feb 23, 2011 at 10:26:20AM -0500, Alan Stern wrote:
> >>In both cases, it appears that the problem is caused by the fact that
> >>the musb host-controller driver doesn't set the hcd->has_tt flag.
> >>
> >>Felipe, you should know where it belongs. It should be easy enough to
> >>add.
> >
> >Sure Alan, it's attached to this mail. Compile tested only though.
> >Michael, would you care to give your tested-by ?
>
> I can do, I'm using exactly the same patch since yesterday. ;)
>
> Tested-by: Alexander Holler <[email protected]>

Thanks a lot Alex, Greg, can you still take this to -rc ? Do you need a
pull request or you can take this one patch ?

--
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
On 02/24/2011 09:57 AM, Felipe Balbi wrote:
> Hi,
>
> On Wed, Feb 23, 2011 at 10:26:20AM -0500, Alan Stern wrote:
>> In both cases, it appears that the problem is caused by the fact that
>> the musb host-controller driver doesn't set the hcd->has_tt flag.
>>
>> Felipe, you should know where it belongs. It should be easy enough to
>> add.
>
> Sure Alan, it's attached to this mail. Compile tested only though.
> Michael, would you care to give your tested-by ?
>

Alexander already did, but I can do now, too. Thanks for the fix.

Tested-by: Michael Jones <[email protected]>

MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
On Thu, Feb 24, 2011 at 11:16:38AM +0200, Felipe Balbi wrote:
> Hi,
>
> On Thu, Feb 24, 2011 at 10:15:23AM +0100, Alexander Holler wrote:
> > >On Wed, Feb 23, 2011 at 10:26:20AM -0500, Alan Stern wrote:
> > >>In both cases, it appears that the problem is caused by the fact that
> > >>the musb host-controller driver doesn't set the hcd->has_tt flag.
> > >>
> > >>Felipe, you should know where it belongs. It should be easy enough to
> > >>add.
> > >
> > >Sure Alan, it's attached to this mail. Compile tested only though.
> > >Michael, would you care to give your tested-by ?
> >
> > I can do, I'm using exactly the same patch since yesterday. ;)
> >
> > Tested-by: Alexander Holler <[email protected]>
>
> Thanks a lot Alex, Greg, can you still take this to -rc ? Do you need a
> pull request or you can take this one patch ?

Wait, where does this need to go? For the final 2.6.38 release and then
also for .37-stable?

Or just .37-stable?

confused.

And no, I don't need a pull request, I can handle one patch through
email :)

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
On Thu, Feb 24, 2011 at 09:18:14AM -0800, Greg KH wrote:
> On Thu, Feb 24, 2011 at 11:16:38AM +0200, Felipe Balbi wrote:
> > Hi,
> >
> > On Thu, Feb 24, 2011 at 10:15:23AM +0100, Alexander Holler wrote:
> > > >On Wed, Feb 23, 2011 at 10:26:20AM -0500, Alan Stern wrote:
> > > >>In both cases, it appears that the problem is caused by the fact that
> > > >>the musb host-controller driver doesn't set the hcd->has_tt flag.
> > > >>
> > > >>Felipe, you should know where it belongs. It should be easy enough to
> > > >>add.
> > > >
> > > >Sure Alan, it's attached to this mail. Compile tested only though.
> > > >Michael, would you care to give your tested-by ?
> > >
> > > I can do, I'm using exactly the same patch since yesterday. ;)
> > >
> > > Tested-by: Alexander Holler <[email protected]>
> >
> > Thanks a lot Alex, Greg, can you still take this to -rc ? Do you need a
> > pull request or you can take this one patch ?
>
> Wait, where does this need to go? For the final 2.6.38 release and then
> also for .37-stable?
>
> Or just .37-stable?
>
> confused.
>
> And no, I don't need a pull request, I can handle one patch through
> email :)

final .38 and .37-stable :-) Thanks Greg :-)

--
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
On Thu, 24 Feb 2011, Felipe Balbi wrote:

> On Thu, Feb 24, 2011 at 09:18:14AM -0800, Greg KH wrote:
> > On Thu, Feb 24, 2011 at 11:16:38AM +0200, Felipe Balbi wrote:
> > > Hi,
> > >
> > > On Thu, Feb 24, 2011 at 10:15:23AM +0100, Alexander Holler wrote:
> > > > >On Wed, Feb 23, 2011 at 10:26:20AM -0500, Alan Stern wrote:
> > > > >>In both cases, it appears that the problem is caused by the fact that
> > > > >>the musb host-controller driver doesn't set the hcd->has_tt flag.
> > > > >>
> > > > >>Felipe, you should know where it belongs. It should be easy enough to
> > > > >>add.
> > > > >
> > > > >Sure Alan, it's attached to this mail. Compile tested only though.
> > > > >Michael, would you care to give your tested-by ?
> > > >
> > > > I can do, I'm using exactly the same patch since yesterday. ;)
> > > >
> > > > Tested-by: Alexander Holler <[email protected]>
> > >
> > > Thanks a lot Alex, Greg, can you still take this to -rc ? Do you need a
> > > pull request or you can take this one patch ?
> >
> > Wait, where does this need to go? For the final 2.6.38 release and then
> > also for .37-stable?
> >
> > Or just .37-stable?
> >
> > confused.
> >
> > And no, I don't need a pull request, I can handle one patch through
> > email :)
>
> final .38 and .37-stable :-) Thanks Greg :-)

It's important that this patch appear in .37-stable at the same time as
the $SUBJECT patch. If that means delaying $SUBJECT for one release,
so be it -- it was not a very important change.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Alexander Holler
Re: [024/115] USB: prevent buggy hubs from crashing the USB stack
February 24, 2011 07:20PM
Hello,

Am 24.02.2011 18:57, schrieb Alan Stern:

> It's important that this patch appear in .37-stable at the same time as
> the $SUBJECT patch. If that means delaying $SUBJECT for one release,
> so be it -- it was not a very important change.

Too late, 2.6.37.1 is already broken. But the patch could be still
applied to 2.6.32-longterm, at least the message I've replied to asked
about objections for that version.

Regards,

Alexander
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
On Thu, Feb 24, 2011 at 12:57:20PM -0500, Alan Stern wrote:
> On Thu, 24 Feb 2011, Felipe Balbi wrote:
>
> > On Thu, Feb 24, 2011 at 09:18:14AM -0800, Greg KH wrote:
> > > On Thu, Feb 24, 2011 at 11:16:38AM +0200, Felipe Balbi wrote:
> > > > Hi,
> > > >
> > > > On Thu, Feb 24, 2011 at 10:15:23AM +0100, Alexander Holler wrote:
> > > > > >On Wed, Feb 23, 2011 at 10:26:20AM -0500, Alan Stern wrote:
> > > > > >>In both cases, it appears that the problem is caused by the fact that
> > > > > >>the musb host-controller driver doesn't set the hcd->has_tt flag.
> > > > > >>
> > > > > >>Felipe, you should know where it belongs. It should be easy enough to
> > > > > >>add.
> > > > > >
> > > > > >Sure Alan, it's attached to this mail. Compile tested only though.
> > > > > >Michael, would you care to give your tested-by ?
> > > > >
> > > > > I can do, I'm using exactly the same patch since yesterday. ;)
> > > > >
> > > > > Tested-by: Alexander Holler <[email protected]>
> > > >
> > > > Thanks a lot Alex, Greg, can you still take this to -rc ? Do you need a
> > > > pull request or you can take this one patch ?
> > >
> > > Wait, where does this need to go? For the final 2.6.38 release and then
> > > also for .37-stable?
> > >
> > > Or just .37-stable?
> > >
> > > confused.
> > >
> > > And no, I don't need a pull request, I can handle one patch through
> > > email :)
> >
> > final .38 and .37-stable :-) Thanks Greg :-)
>
> It's important that this patch appear in .37-stable at the same time as
> the $SUBJECT patch. If that means delaying $SUBJECT for one release,
> so be it -- it was not a very important change.

Ok, I'll drop this from the next .37-stable release until this happens.

thanks for letting me know.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
On Thu, Feb 24, 2011 at 10:12:46AM -0800, Greg KH wrote:
> On Thu, Feb 24, 2011 at 12:57:20PM -0500, Alan Stern wrote:
> > On Thu, 24 Feb 2011, Felipe Balbi wrote:
> >
> > > On Thu, Feb 24, 2011 at 09:18:14AM -0800, Greg KH wrote:
> > > > On Thu, Feb 24, 2011 at 11:16:38AM +0200, Felipe Balbi wrote:
> > > > > Hi,
> > > > >
> > > > > On Thu, Feb 24, 2011 at 10:15:23AM +0100, Alexander Holler wrote:
> > > > > > >On Wed, Feb 23, 2011 at 10:26:20AM -0500, Alan Stern wrote:
> > > > > > >>In both cases, it appears that the problem is caused by the fact that
> > > > > > >>the musb host-controller driver doesn't set the hcd->has_tt flag.
> > > > > > >>
> > > > > > >>Felipe, you should know where it belongs. It should be easy enough to
> > > > > > >>add.
> > > > > > >
> > > > > > >Sure Alan, it's attached to this mail. Compile tested only though.
> > > > > > >Michael, would you care to give your tested-by ?
> > > > > >
> > > > > > I can do, I'm using exactly the same patch since yesterday. ;)
> > > > > >
> > > > > > Tested-by: Alexander Holler <[email protected]>
> > > > >
> > > > > Thanks a lot Alex, Greg, can you still take this to -rc ? Do you need a
> > > > > pull request or you can take this one patch ?
> > > >
> > > > Wait, where does this need to go? For the final 2.6.38 release and then
> > > > also for .37-stable?
> > > >
> > > > Or just .37-stable?
> > > >
> > > > confused.
> > > >
> > > > And no, I don't need a pull request, I can handle one patch through
> > > > email :)
> > >
> > > final .38 and .37-stable :-) Thanks Greg :-)
> >
> > It's important that this patch appear in .37-stable at the same time as
> > the $SUBJECT patch. If that means delaying $SUBJECT for one release,
> > so be it -- it was not a very important change.
>
> Ok, I'll drop this from the next .37-stable release until this happens.

Oops, wait, that's going to be hard as it's already in 2.6.37.1.

Oh, I guess I can revert it for the .2 release in a few hours, and then
add it back in for .3...

I'll go do that.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
On Thu, Feb 24, 2011 at 07:11:34PM +0100, Alexander Holler wrote:
> Hello,
>
> Am 24.02.2011 18:57, schrieb Alan Stern:
>
> >It's important that this patch appear in .37-stable at the same time as
> >the $SUBJECT patch. If that means delaying $SUBJECT for one release,
> >so be it -- it was not a very important change.
>
> Too late, 2.6.37.1 is already broken. But the patch could be still
> applied to 2.6.32-longterm, at least the message I've replied to
> asked about objections for that version.

It's too late for that release as well, as it's already included in the
last .32 stable release. I'll revert it there also for now.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Sorry, only registered users may post in this forum.

Click here to login