Netdev List
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Jamal Hadi Salim <jhs@mojatatu.com>,  netdev@vger.kernel.org
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
	 Jiri Pirko <jiri@resnulli.us>,
	 Andrew Lunn <andrew+netdev@lunn.ch>,
	 "David S . Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@kernel.org>,
	 Guillaume Nault <gnault@redhat.com>,
	 Simon Horman <horms@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	 Victor Nogueira <victor@mojatatu.com>,  Vega <vega@nebusec.ai>,
	 Ren Wei <n05ec@lzu.edu.cn>,
	 Herbert Xu <herbert@gondor.apana.org.au>,
	 Jason Wang <jasowangio@gmail.com>,
	 Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	 stable@vger.kernel.org
Subject: Re: [PATCH net 1/5] net/sched: act_vlan: reject short linear Ethernet headers after POP_ETH
Date: Thu, 22 Oct 2026 11:21:05 -0400	[thread overview]
Message-ID: <willemdebruijn.kernel.38722ee638a21@gmail.com> (raw)
In-Reply-To: <ACT-N6N4.v1.r0.20261022051412-1@mojatatu.com>

Jamal Hadi Salim wrote:
> The issue:
> act_vlan POP_ETH can leave a linear area shorter than ETH_HLEN; a
> subsequent eth_type_trans() may then BUG in __skb_pull() when the frame
> is redirected to an Ethernet device.
> 
> The Fix:
> Drop the packet at the producer boundary when skb_headlen() is shorter
> than ETH_HLEN after skb_eth_pop().
> 
> Conditions to recreate the bug:
> - egress tc filter on lo: action vlan pop_eth.
> - AF_PACKET SOCK_RAW with PACKET_VNET_HDR, hdr_len=28, and a non-linear
>   eth / inner-eth frame.
> - The pop leaves skb_headlen(skb) < ETH_HLEN; a following
>   eth_type_trans() can BUG in __skb_pull().
> 
> Fixes: 19fbcb36a39e ("net/sched: act_vlan: Add {POP,PUSH}_ETH actions")
> Reported-by: Vega <vega@nebusec.ai>
> Link: https://lore.kernel.org/r/40fe2d7dfce13411bfbe9271c0f7c54fb7e88e3b.1782548651.git.bronzed_45_vested@icloud.com/
> Cc: stable@vger.kernel.org
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> Reviewed-by: Victor Nogueira <victor@mojatatu.com>
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
> ---
>  net/sched/act_vlan.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c
> index 6a375fdc63dd..ddf03b08bfe8 100644
> --- a/net/sched/act_vlan.c
> +++ b/net/sched/act_vlan.c
> @@ -79,6 +79,8 @@ TC_INDIRECT_SCOPE int tcf_vlan_act(struct sk_buff *skb,
>  		err = skb_eth_pop(skb);
>  		if (err)
>  			goto drop;
> +		if (unlikely(skb_headlen(skb) < ETH_HLEN))
> +			goto drop;

Could it try to pull the header and only drop if the packet is too short?

>  		break;
>  	case TCA_VLAN_ACT_PUSH_ETH:
>  		err = skb_eth_push(skb, p->tcfv_push_dst, p->tcfv_push_src);
> -- 
> 2.43.0
> 



  parent reply	other threads:[~2026-10-22 15:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22  9:22 [PATCH net 0/5] net: reject short linear Ethernet headers from tc actions, tun and OVS Jamal Hadi Salim
2026-10-22  9:22 ` [PATCH net 1/5] net/sched: act_vlan: reject short linear Ethernet headers after POP_ETH Jamal Hadi Salim
2026-10-22  9:22   ` [PATCH net 2/5] net/sched: act_mpls: reject short linear Ethernet headers after pop Jamal Hadi Salim
2026-10-22  9:22     ` [PATCH net 3/5] net: tun: keep TUN short linear copy hints safe Jamal Hadi Salim
2026-10-22  9:22       ` [PATCH net 4/5] net: openvswitch: ensure a linear inner Ethernet header on TEB pop Jamal Hadi Salim
2026-10-22  9:22         ` [PATCH net 5/5] net: openvswitch: ensure a linear inner Ethernet header on NSH pop Jamal Hadi Salim
2026-10-22  9:54           ` Jiri Benc
2026-10-22 12:42           ` Ilya Maximets
2026-10-22 17:47             ` Eric Dumazet
2026-10-22 12:41         ` [PATCH net 4/5] net: openvswitch: ensure a linear inner Ethernet header on TEB pop Ilya Maximets
2026-10-22 17:47           ` Eric Dumazet
2026-10-22 15:22       ` [PATCH net 3/5] net: tun: keep TUN short linear copy hints safe Willem de Bruijn
2026-10-22 16:17         ` Jamal Hadi Salim
2026-10-22 18:00           ` Eric Dumazet
2026-10-22 20:18             ` Jamal Hadi Salim
2026-10-22 17:52     ` [PATCH net 2/5] net/sched: act_mpls: reject short linear Ethernet headers after pop Eric Dumazet
2026-10-22 15:21   ` Willem de Bruijn [this message]
2026-10-22 16:01     ` [PATCH net 1/5] net/sched: act_vlan: reject short linear Ethernet headers after POP_ETH Jamal Hadi Salim
2026-10-22 17:57       ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=willemdebruijn.kernel.38722ee638a21@gmail.com \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=gnault@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=horms@kernel.org \
    --cc=jasowangio@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=n05ec@lzu.edu.cn \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=vega@nebusec.ai \
    --cc=victor@mojatatu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox