diff options
author | Yojiro Uo <yuo@cvs.openbsd.org> | 2009-06-05 20:18:04 +0000 |
---|---|---|
committer | Yojiro Uo <yuo@cvs.openbsd.org> | 2009-06-05 20:18:04 +0000 |
commit | c0a8479043e455913cb0d56eac2013c4ddb76df0 (patch) | |
tree | 6bb975bc5f466ca3daf60821a92ec8f18d5cdb00 /sys/dev/usb | |
parent | da5a280f67fd9cfa718fcf2773680e59ca2ff31b (diff) |
catch up NetBSD kern/41048.
check for a non-NULL configuration descriptor before dereferencing.
ok deraadt@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/ugen.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 24b185341f2..09bda694e12 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ugen.c,v 1.56 2008/12/14 16:48:04 fgsch Exp $ */ +/* $OpenBSD: ugen.c,v 1.57 2009/06/05 20:18:03 yuo 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 $ */ @@ -193,6 +193,7 @@ int ugen_set_config(struct ugen_softc *sc, int configno) { usbd_device_handle dev = sc->sc_udev; + usb_config_descriptor_t *cdesc; usbd_interface_handle iface; usb_endpoint_descriptor_t *ed; struct ugen_endpoint *sce; @@ -217,7 +218,8 @@ ugen_set_config(struct ugen_softc *sc, int configno) } /* Avoid setting the current value. */ - if (usbd_get_config_descriptor(dev)->bConfigurationValue != configno) { + cdesc = usbd_get_config_descriptor(dev); + if (!cdesc || cdesc->bConfigurationValue != configno) { err = usbd_set_config_no(dev, configno, 1); if (err) return (err); |