Re: [RFC] USB: check for transmissible packet sizes when matching endpoints

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

 



On Thu, Nov 30, 2023 at 12:39:45PM +0100, Oliver Neukum wrote:
> Looking for a bulk endpoint to transfer data over
> we need something that can transmit data.
> 
> Signed-off-by: Oliver Neukum <oneukum@xxxxxxxx>
> ---
>  drivers/usb/core/usb.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
> index 2a938cf47ccd..d163bd279021 100644
> --- a/drivers/usb/core/usb.c
> +++ b/drivers/usb/core/usb.c
> @@ -80,6 +80,9 @@ static bool match_endpoint(struct usb_endpoint_descriptor *epd,
>  {
>  	switch (usb_endpoint_type(epd)) {
>  	case USB_ENDPOINT_XFER_BULK:
> +		if (!usb_endpoint_maxp(epd))
> +			return false;
> +
>  		if (usb_endpoint_dir_in(epd)) {
>  			if (bulk_in && !*bulk_in) {
>  				*bulk_in = epd;

This reminds me of 2548288b4fb0 ("USB: Fix: Don't skip endpoint
descriptors with maxpacket=0") and 

	https://lore.kernel.org/all/20200102112045.GA17614@localhost/

We have at least one ftdi device with broken descriptors that would be
hurt by this if usb serial used this helper to look up the endpoint.
That isn't the case currently, but in theory there could be other
devices like that.

Is there a real issue you're trying to address here?

Johan




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

  Powered by Linux