Skip to content

Commit

Permalink
ued may be NULL here which will cause a panic... reproducable by
Browse files Browse the repository at this point in the history
simply doing a usbconfig reset on a device which doesn't reset itself
properly...
  • Loading branch information
jmgurney committed Jun 29, 2021
1 parent f943609 commit 3d51041
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions sys/dev/usb/net/if_cdce.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,18 +709,18 @@ cdce_attach(device_t dev)
if ((ued == NULL) || (ued->bLength < sizeof(*ued))) {
error = USB_ERR_INVAL;
} else {
/*
* ECM 1.2 doesn't say it excludes the CRC, but states that it's
* normally 1514, which excludes the CRC.
*/
DPRINTF("max segsize: %d\n", UGETW(ued->wMaxSegmentSize));
if (UGETW(ued->wMaxSegmentSize) >= (ETHER_MAX_LEN - ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN))
sc->sc_flags |= CDCE_FLAG_VLAN;

error = usbd_req_get_string_any(uaa->device, NULL,
eaddr_str, sizeof(eaddr_str), ued->iMacAddress);
}

/*
* ECM 1.2 doesn't say it excludes the CRC, but states that it's
* normally 1514, which excludes the CRC.
*/
DPRINTF("max segsize: %d\n", UGETW(ued->wMaxSegmentSize));
if (UGETW(ued->wMaxSegmentSize) >= (ETHER_MAX_LEN - ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN))
sc->sc_flags |= CDCE_FLAG_VLAN;

if (error) {
/* fake MAC address */

Expand Down

0 comments on commit 3d51041

Please sign in to comment.