Skip to content

Conversation

@ethan4984
Copy link

No description provided.

netbsd-srcmastr pushed a commit that referenced this pull request Oct 19, 2025
	sys/dev/usb/xhci.c: revision 1.191
	sys/dev/usb/usb_subr.c: revision 1.280
	sys/dev/usb/usb_subr.c: revision 1.281
	sys/dev/usb/usbdivar.h: revision 1.140

usb(9): Record config index, not just number, in struct usbd_device.

The index is a zero-based index in [0, bNumConfigurations), or -1 for
unconfigured.

The number is an arbitrary value of a config descriptor's
bConfigurationValue field, or 0 for unconfigured -- with the tricky
caveat that bConfigurationValue might also be 0.

Preparation for fixing:
PR kern/59185: panic over KASSERTMSG(dev->ud_ifaces == NULL) on Dell
Latitude 7490
PR kern/59624: Booting NetBSD-11 from USB on my Dell machine panics
and hangs
PR kern/57447: HEAD fails to probe USB devices and fails to boot up


usb(9): Use ud_configidx, not ud_config, to see if unconfigured.
ud_config is a device-provided quantity in the config descriptor's
bConfigurationValue, and a faulty (or malicious) device can provide 0
for that value, which coincides with our software sentinel value
USBD_UNCONFIG_NO of 0.

Instead of testing ud_config, test ud_configidx, which is an index in
[0, bNumConfigurations) or -1, for which the device cannot confuse us
by a value that coincides with the sentinel -1.

PR kern/59185: panic over KASSERTMSG(dev->ud_ifaces == NULL) on Dell
Latitude 7490
PR kern/59624: Booting NetBSD-11 from USB on my Dell machine panics
and hangs
PR kern/57447: HEAD fails to probe USB devices and fails to boot up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant