Date: Sat, 08 Jun 2019 04:23:14 +0000 From: bugzilla-noreply@freebsd.org To: usb@FreeBSD.org Subject: [Bug 238412] libusb_get_config_descriptor() should return LIBUSB_NOT_FOUND on out-of-range config_index Message-ID: <bug-238412-19105@https.bugs.freebsd.org/bugzilla/>
index | next in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238412 Bug ID: 238412 Summary: libusb_get_config_descriptor() should return LIBUSB_NOT_FOUND on out-of-range config_index Product: Base System Version: 11.3-STABLE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: usb Assignee: usb@FreeBSD.org Reporter: takahiro.kurosawa@gmail.com Created attachment 204897 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=204897&action=edit proposed patch libusb_get_config_descriptor() in FreeBSD issues a get_config_descriptor request even if the config_index argument is out of range. On the other hand, the function in Linux checks the config_index argument against bNumConfigurations in the device descriptor and returns LIBUSB_ERROR_NOT_FOUND without issuing get_config_descriptor requests. It seems that get_config_descriptor requests with invalid config_index values for most USB devices fail, but there is a device (USB DrDAQ from Pico Technology) that does not check the config_index value. The request for USB DrDAQ succeeds even if the config_index value is invalid. As a result, the behavior of libusb_get_config_descriptor() in FreeBSD differs from the one in Linux on such a device. This makes qemu hang on FreeBSD with USB passthrough enabled because qemu repeats libusb_get_config_descriptor() with incrementing config_index until the function returns an error. The specification of libusb_get_config_descriptor(): http://libusb.sourceforge.net/api-1.0/group__libusb__desc.html#gaa635d9aec77d\e4895dd0896ccf001532 The implementation in Linux: https://github.com/libusb/libusb/blob/v1.0.22/libusb/descriptor.c#L625 -- You are receiving this mail because: You are the assignee for the bug.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-238412-19105>
