diff options
author | 2005-05-13 18:42:50 +0000 | |
---|---|---|
committer | 2005-05-13 18:42:50 +0000 | |
commit | e62a8d44b93511a386868b35c7b50aab226aa250 (patch) | |
tree | 005de59bc19685f639d653b5b850ea2acfe4f988 | |
parent | give disassociation a chance when turning the interface down while associated. (diff) | |
download | wireguard-openbsd-e62a8d44b93511a386868b35c7b50aab226aa250.tar.xz wireguard-openbsd-e62a8d44b93511a386868b35c7b50aab226aa250.zip |
make sure all endpoint descriptors have been found during the attachment.
-rw-r--r-- | sys/dev/usb/if_ral.c | 9 | ||||
-rw-r--r-- | sys/dev/usb/if_ralvar.h | 6 |
2 files changed, 10 insertions, 5 deletions
diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index d2994c6c81b..5e37b2c1918 100644 --- a/sys/dev/usb/if_ral.c +++ b/sys/dev/usb/if_ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ral.c,v 1.29 2005/05/13 18:17:08 damien Exp $ */ +/* $OpenBSD: if_ral.c,v 1.30 2005/05/13 18:42:50 damien Exp $ */ /*- * Copyright (c) 2005 @@ -373,10 +373,11 @@ USB_ATTACH(ural) */ id = usbd_get_interface_descriptor(sc->sc_iface); + sc->sc_rx_no = sc->sc_tx_no = -1; for (i = 0; i < id->bNumEndpoints; i++) { ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { - printf("%s: no endpoint descriptor for %d\n", + printf("%s: no endpoint descriptor for iface %d\n", USBDEVNAME(sc->sc_dev), i); USB_ATTACH_ERROR_RETURN; } @@ -388,6 +389,10 @@ USB_ATTACH(ural) UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) sc->sc_tx_no = ed->bEndpointAddress; } + if (sc->sc_rx_no == -1 || sc->sc_tx_no == -1) { + printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); + USB_ATTACH_ERROR_RETURN; + } usb_init_task(&sc->sc_task, ural_task, sc); timeout_set(&sc->scan_ch, ural_next_scan, sc); diff --git a/sys/dev/usb/if_ralvar.h b/sys/dev/usb/if_ralvar.h index acbee13a967..9b553b20c41 100644 --- a/sys/dev/usb/if_ralvar.h +++ b/sys/dev/usb/if_ralvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ralvar.h,v 1.1 2005/03/16 20:17:10 damien Exp $ */ +/* $OpenBSD: if_ralvar.h,v 1.2 2005/05/13 18:42:50 damien Exp $ */ /*- * Copyright (c) 2005 @@ -76,8 +76,8 @@ struct ural_softc { usbd_device_handle sc_udev; usbd_interface_handle sc_iface; - uint8_t sc_rx_no; - uint8_t sc_tx_no; + int sc_rx_no; + int sc_tx_no; uint32_t asic_rev; uint8_t rf_rev; |