From 6e30a360f81a42d4e30f13ea08ef9a74a8707259 Mon Sep 17 00:00:00 2001 From: hselasky Date: Mon, 9 Nov 2015 11:29:54 +0000 Subject: [PATCH] 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. git-svn-id: svn://svn.freebsd.org/base/stable/8@290609 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/usb/net/if_cdce.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/usb/net/if_cdce.c b/sys/dev/usb/net/if_cdce.c index 097df3d99..42dcf7863 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); -- 2.42.0