summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authormglocker <mglocker@openbsd.org>2021-02-05 08:17:22 +0000
committermglocker <mglocker@openbsd.org>2021-02-05 08:17:22 +0000
commit2897a1a84d74c44e57465fa4ac34d3a1376e5edb (patch)
tree54fc14387a478b0fbe5d9a6da6baf7bc9e71a1be /sys/dev
parenthostname is not specified by POSIX but uname -n is, so use the latter for (diff)
downloadwireguard-openbsd-2897a1a84d74c44e57465fa4ac34d3a1376e5edb.tar.xz
wireguard-openbsd-2897a1a84d74c44e57465fa4ac34d3a1376e5edb.zip
Prevent that when ugen(4) tries to set an alternative configuration
descriptor (usually doesn't happen), that we continue to use an outdated cdesc pointer which still refers to the previous cdesc. Instead update the cdesc pointer to the new configuration descriptor. Reported by Thomas Jeunet <cleptho AT gmail DOT com> ok phessler@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/ugen.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c
index 78d990b1821..450a39d9055 100644
--- a/sys/dev/usb/ugen.c
+++ b/sys/dev/usb/ugen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ugen.c,v 1.114 2021/02/01 09:21:51 mglocker Exp $ */
+/* $OpenBSD: ugen.c,v 1.115 2021/02/05 08:17:22 mglocker Exp $ */
/* $NetBSD: ugen.c,v 1.63 2002/11/26 18:49:48 christos Exp $ */
/* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */
@@ -220,6 +220,10 @@ ugen_set_config(struct ugen_softc *sc, int configno)
err = usbd_set_config_no(dev, configno, 1);
if (err)
return (err);
+ cdesc = usbd_get_config_descriptor(dev);
+ if (cdesc == NULL ||
+ cdesc->bConfigurationValue != configno)
+ return (USBD_INVAL);
}
}