summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/net/if_cdce.c
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2015-11-09 11:24:59 +0000
committerhselasky <hselasky@FreeBSD.org>2015-11-09 11:24:59 +0000
commitf0bd9d7687ebb4a333ffb79acccf6ac46805f21a (patch)
treed24a60f08cae3e86dc762b5a850e182cb7ff5ca0 /sys/dev/usb/net/if_cdce.c
parentf1478935ff04599c9756ed48a9307dae01308f24 (diff)
downloadFreeBSD-src-f0bd9d7687ebb4a333ffb79acccf6ac46805f21a.zip
FreeBSD-src-f0bd9d7687ebb4a333ffb79acccf6ac46805f21a.tar.gz
MFC r290441:
Fix for unaligned IP-header. The mbuf length fields must be set before m_adj() is called else m_adj() will not always adjust the mbuf and an unaligned read exception can trigger inside the network stack. This can happen on platforms where unaligned reads are not supported. Adjust a length check to include the 2-byte ethernet alignment while at it.
Diffstat (limited to 'sys/dev/usb/net/if_cdce.c')
-rw-r--r--sys/dev/usb/net/if_cdce.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/dev/usb/net/if_cdce.c b/sys/dev/usb/net/if_cdce.c
index 6649bc0..b107232 100644
--- a/sys/dev/usb/net/if_cdce.c
+++ b/sys/dev/usb/net/if_cdce.c
@@ -1381,6 +1381,7 @@ cdce_ncm_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
/* check if we have a buffer */
if (m) {
+ m->m_len = m->m_pkthdr.len = temp + ETHER_ALIGN;
m_adj(m, ETHER_ALIGN);
usbd_copy_out(pc, offset, m->m_data, temp);
OpenPOWER on IntegriCloud