Re: [PATCH v2 net 4/4] net: enetc: let core segment GSO skb when headers exceed TSO_HEADER_SIZE
From: Eric Dumazet
Date: Thu Nov 19 2026 - 04:38:37 EST
Le jeu. 19 nov. 2026 à 09:44, Vladimir Oltean
<vladimir.oltean@xxxxxxx> a écrit :
>
> Hi Eric,
>
> On Thu, Nov 19, 2026 at 01:03:16AM +0100, Eric Dumazet wrote:
> > > Bizarrely, enetc is the only affected driver, because the core
> > > accidentally protects most other drivers against this bug in
> > > gso_features_check(). There, we have this logic that saves the day:
> > >
> > > /* NETIF_F_IPV6_CSUM does not support IPv6 extension headers,
> > > * so neither does TSO that depends on it.
> > > */
> > > if (features & NETIF_F_IPV6_CSUM &&
> > > skb_has_ipv6_extension_hdr(skb))
> > > features &= ~(NETIF_F_IPV6_CSUM | NETIF_F_TSO6 | NETIF_F_GSO_UDP_L4);
> > >
> > > enetc is the outlier because it only advertises the more complete
> > > NETIF_F_HW_CSUM, so for it, this fixup does not clear the NETIF_F_TSO6
> > > and NETIF_F_GSO_UDP_L4 bits.
> > >
> > > [ astute reviewers may ask: what if we disable NETIF_F_IPV6_CSUM at
> > > runtime, via ethtool -k, so as to bypass this fixup, don't we make
> > > all drivers vulnerable?
> > > No, because netdev_fix_features() will trigger the code path which
> > > also prints "Dropping TSO6 features since no CSUM feature.\n".
> > > So TSO skbs will now be segmented in the stack. ]
> > >
> > > Surveying every driver that uses TSO_HEADER_SIZE:
> > >
> > > Driver | TSO6 | Checksum feature | Core guard fires? | Verdict
> > > ---------------|---------------------|-------------------|---------
> > > enetc | yes | NETIF_F_HW_CSUM | no | vulnerable
> > > bnxt | yes | NETIF_F_IPV6_CSUM | yes | safe
> > > nicvf | yes | NETIF_F_IPV6_CSUM | yes | safe
> > > otx2 | yes | NETIF_F_IPV6_CSUM | yes | safe
> > > fec | no | NETIF_F_IPV6_CSUM | n/a | safe
> > > mvneta | no | NETIF_F_IPV6_CSUM | n/a | safe
> > > mvpp2 | no | NETIF_F_IPV6_CSUM | n/a | safe
> > > mv643xx | no | NETIF_F_IP_CSUM | n/a | safe
> > > dpaa2 | no | NETIF_F_IPV6_CSUM | n/a | safe (*)
> > >
> > > (*) dpaa2 also uses a fixed-size kmalloc(TSO_HEADER_SIZE) per segment,
> > > so the identical overflow would apply if it ever gained NETIF_F_TSO6.
> > >
> > > The above survey is what influenced the decision to make a localized
> > > patch in enetc_features_check() rather than create a huge disturbance in
> > > the core, even though, IMO, TSO_HEADER_SIZE is a huge foot gun.
> >
> > I should probably rework my series :
> > https://lore.kernel.org/netdev/20260403043237.3909226-1-edumazet@xxxxxxxxxx/
>
> Do you disagree with my analysis that only enetc risks corruption? I mean,
> for a second layer of defense, having tso_features_check() everywhere
> TSO_HEADER_SIZE is used probably makes sense, but I opted for a targeted
> fix because I couldn't justify it for the other drivers.
I agree with your analysis, I could not find another driver where
headers can exceed TSO_HEADER_SIZE today. Your targeted fix is fine
for net.
The other drivers are only safe as a side effect of the
NETIF_F_IPV6_CSUM rule in gso_features_check(), and none of them
bounds the header length in an ndo_features_check(). I might respin
the tso_features_check() series for net-next as a second layer
(calling vlan_features_check() this time), and enetc can be
converted on top.
Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>