[PATCH net v2 0/2] octeon_ep, octeon_ep_vf: fix skb frags overflow in the RX path

From: Maoyi Xie

Date: Thu Jul 02 2026 - 14:43:59 EST


Both octeon_ep and octeon_ep_vf build an skb for a multi-buffer RX packet
by adding one fragment per buffer_size chunk of a device-reported length.
Neither bounds the count against MAX_SKB_FRAGS. A long packet yields about
18 fragments, one past the default MAX_SKB_FRAGS of 17, so
skb_add_rx_frag() writes past shinfo->frags[].

Each driver now checks the fragment count before it builds the skb and
drops a packet that would not fit.

v2:
- move the check before (napi_)build_skb() so the driver does not build an
skb only to free it, per Maciej Fijalkowski.
- the frag count check uses the same u16 length the fragment loop uses.
The repeated linear/non-linear code in octeon_ep_vf that Maciej noted is a
separate cleanup, left for net-next to keep this fix minimal.

v1: https://lore.kernel.org/r/20260701112825.1653044-1-maoyixie.tju@xxxxxxxxx


Maoyi Xie (2):
octeon_ep: fix skb frags overflow in the RX path
octeon_ep_vf: fix skb frags overflow in the RX path

.../net/ethernet/marvell/octeon_ep/octep_rx.c | 9 +++++++++
.../marvell/octeon_ep_vf/octep_vf_rx.c | 20 +++++++++++++++++++
2 files changed, 29 insertions(+)

--
2.34.1