opnsense-src/sys/dev/usb/net
Kyle Evans 40ad87e958 usb: if_ure: stop touching the mbuf accounting on rxq insertion
uether_rxmbuf() assumes the uether_newbuf() model where the caller has
just set m_len to the entire size of the mbuf, and passed the final
size into uether_rxmbuf() for finalization.

In if_ure we're creating our own mbuf chains, and the accounting is all
already accurate.  uether_rxmbuf's logic won't work at all for a chain,
so let's add an assertion to that effect (but I think the other callers
were all OK).

This fixes a panic on my Windows DevKit when undergoing any kind of
network stress that surfaces after the bogus mbuf is injected into the
network stack (usually observed in `m_dup`).

markj and I had spent some time investigating it and decided there's
some kind of buffer underrun happening; the rx packet descriptor reports
a length longer than what's actually available.  We discard the rest of
the transfer, but then we end up fetching it in a subsequent transfer
and end up casting packet data to a `struct ure_rxpkt` incorrectly.  It
would be better to fix the underlying root cause, but this is a
reasonable mitigation in the interim.

Reviewed by:	markj
Fixes:	7d5522e16a ("A major update to the ure driver.")
Differential Revision:	https://reviews.freebsd.org/D43465
2025-04-20 13:28:12 -05:00
..
if_aue.c usb: Kill left-over cdefs.h includes 2025-03-04 14:44:22 -07:00
if_auereg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_axe.c usb: Kill left-over cdefs.h includes 2025-03-04 14:44:22 -07:00
if_axereg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_axge.c usb: Kill left-over cdefs.h includes 2025-03-04 14:44:22 -07:00
if_axgereg.h axge: Add support for AX88179A 2023-10-04 11:08:06 -04:00
if_cdce.c usb: Kill left-over cdefs.h includes 2025-03-04 14:44:22 -07:00
if_cdceem.c usb: Kill left-over cdefs.h includes 2025-03-04 14:44:22 -07:00
if_cdcereg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_cue.c usb: Kill left-over cdefs.h includes 2025-03-04 14:44:22 -07:00
if_cuereg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_ipheth.c usb: Kill left-over cdefs.h includes 2025-03-04 14:44:22 -07:00
if_iphethvar.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
if_kue.c usb: Kill left-over cdefs.h includes 2025-03-04 14:44:22 -07:00
if_kuefw.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_kuereg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_mos.c usb: Kill left-over cdefs.h includes 2025-03-04 14:44:22 -07:00
if_mosreg.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
if_muge.c usb: Kill left-over cdefs.h includes 2025-03-04 14:44:22 -07:00
if_mugereg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rue.c usb: Kill left-over cdefs.h includes 2025-03-04 14:44:22 -07:00
if_ruereg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_smsc.c usb: Kill left-over cdefs.h includes 2025-03-04 14:44:22 -07:00
if_smscreg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_udav.c usb: Kill left-over cdefs.h includes 2025-03-04 14:44:22 -07:00
if_udavreg.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
if_umb.c umb: Introduce the USB umb(4) network driver 2025-01-20 23:46:15 +00:00
if_umbreg.h umb: Introduce the USB umb(4) network driver 2025-01-20 23:46:15 +00:00
if_ure.c usb: if_ure: stop touching the mbuf accounting on rxq insertion 2025-04-20 13:28:12 -05:00
if_urereg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_urndis.c usb: Kill left-over cdefs.h includes 2025-03-04 14:44:22 -07:00
if_urndisreg.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
if_usie.c if_usie: fix typo 2024-09-22 00:56:37 +02:00
if_usievar.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
mbim.h umb: Introduce the USB umb(4) network driver 2025-01-20 23:46:15 +00:00
ruephy.c usb: Kill left-over cdefs.h includes 2025-03-04 14:44:22 -07:00
ruephyreg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
uhso.c net: Remove unneeded NULL check for the allocated ifnet 2024-06-28 18:16:29 +08:00
usb_ethernet.c usb: if_ure: stop touching the mbuf accounting on rxq insertion 2025-04-20 13:28:12 -05:00
usb_ethernet.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00