On Thu, Nov 30, 2023 at 07:22:24PM +0100, Oliver Neukum wrote: > On 30.11.23 17:52, Alan Stern wrote: > > > Why would a bulk endpoint descriptor's maxpacket size ever be 0? Are > > Because evil people connect evil devices to nice computers. > > > there any devices that have such a thing? > > > > If we do encounter one, it will trigger a dev_notice() in config.c's > > usb_parse_endpoint(). > > Yes, but that does not change what drivers will do when they > try to use the endpoint. In theory, it _is_ possible to use an endpoint whose maxpacket value is 0. All you can do with it is transfer zero-length packets -- but somebody might want to do just that. On the other hand, the USB-2 spec (section 5.8.3) does say that the only valid sizes for bulk-endpoint maxpacket values are 8, 16, 32, 64, and 512, depending on the speed (add 1024 for USB-3). We do accept other sizes, but perhaps we should rule out size 0. The right place to do this is in usb_parse_endpoint(). Oddly enough, the spec does allow the maxpacket size for interrupt endpoints to be 0 (section 5.7.3). usb_submit_urb() should check for this case and fail a submission if the transfer_length != 0. Regardless, the endpoint-matching routines are not the right place for these checks. Alan Stern