summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormglocker <mglocker@openbsd.org>2021-02-03 11:34:24 +0000
committermglocker <mglocker@openbsd.org>2021-02-03 11:34:24 +0000
commit58176493d883fc502ed475018613bb4dfb53c9d2 (patch)
tree92be203fae6badc1c6db52cb5fc889f0d2f71d52
parentRemove rsync.c from the test tool builds, nothing depends on that anymore (diff)
downloadwireguard-openbsd-58176493d883fc502ed475018613bb4dfb53c9d2.tar.xz
wireguard-openbsd-58176493d883fc502ed475018613bb4dfb53c9d2.zip
After the rev. 1.108 commit we see some issues with ugen(4) behaviour,
which finally makes umb(4) fail, since ugen(4) attaches to one of the umb(4) interfaces, fails, and marks the whole device dying. Therefore make usbd_device2interface_handle() backwards compatible again. Problem reported by Mikolaj Kucharski. ok edd@
-rw-r--r--sys/dev/usb/usbdi.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c
index 38785e06c1c..1483faf72e1 100644
--- a/sys/dev/usb/usbdi.c
+++ b/sys/dev/usb/usbdi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbdi.c,v 1.109 2021/02/01 09:21:51 mglocker Exp $ */
+/* $OpenBSD: usbdi.c,v 1.110 2021/02/03 11:34:24 mglocker Exp $ */
/* $NetBSD: usbdi.c,v 1.103 2002/09/27 15:37:38 provos Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */
@@ -642,6 +642,10 @@ usbd_device2interface_handle(struct usbd_device *dev, u_int8_t ifaceno,
if (dev->cdesc == NULL)
return (USBD_NOT_CONFIGURED);
+ if (ifaceno < dev->cdesc->bNumInterfaces) {
+ *iface = &dev->ifaces[ifaceno];
+ return (USBD_NORMAL_COMPLETION);
+ }
/*
* The correct interface should be at dev->ifaces[ifaceno], but we've
* seen non-compliant devices in the wild which present non-contiguous