Re: [RFC 13/15] xhci: Return a USB 3.0 hub descriptor for USB3 roothub.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 29 Nov 2010, Sarah Sharp wrote:

> Return the correct USB 3.0 hub descriptor when khubd (or usbfs) asks for
> the roothub descriptor of the main usb_hcd.  Fill in DeviceRemovable for
> the USB 2.0 and USB 3.0 roothub descriptors, using the Device Removable
> bit in the port status and control registers.  I think xHCI is the first
> host controller to actually properly set these bits (other hosts say all
> devices are removable).

Other host controllers don't have Device Removable bits in their port
status and control registers.

> When userspace asks for a USB 2.0-style hub descriptor for the USB 3.0
> roothub, stall the endpoint.  This is what real external USB 3.0 hubs do.
> We can't just fill in the buffer with a USB 3.0 hub descriptor, because
> that descriptor can be longer than a USB 2.0 hub descriptor with a similar
> number of ports, and we could cause a buffer overflow.

Yes, you shouldn't return a USB-3 descriptor when asked for a USB-2 
descriptor, but not for the reason you stated.  The fact that the 
descriptor might be too long doesn't matter; the transfer will be 
truncated to fit in the buffer provided.  After all, even now a program 
can use usbfs to ask for a hub descriptor for a non-USB-3 controller 
and pass a buffer that's too small.

No, the real reason for not doing it is simply that you would be 
returning incorrect data to the caller -- not what was asked for.

Alan Stern

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux