From: sashiko-bot@kernel.org
To: wei.fang@oss.nxp.com
Cc: bpf@vger.kernel.org, Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH net 1/2] net: packet: fix skb->protocol not updated after VLAN network header adjustment
Date: Thu, 06 Aug 2026 10:49:59 +0000 [thread overview]
Message-ID: <20260806105000.5B9B71F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260805105314.3882595-2-wei.fang@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Overwriting `skb->protocol` with the inner protocol while leaving the VLAN tag inline in the payload hides the VLAN tag from the network stack and drivers. This breaks packet transmission for VLAN-tagged packets sent via AF_PACKET SOCK_RAW.
--
--- Patch [1]: [PATCH net 1/2] net: packet: fix skb->protocol not updated after VLAN network header adjustment ---
commit f62ea124b860e7404cd95296234dc5505cb676c4
Author: Wei Fang <wei.fang@nxp.com>
net: packet: fix skb->protocol not updated after VLAN network header adjustment
This commit updates skb->protocol with the inner protocol resolved by
vlan_get_protocol_and_depth() for VLAN-tagged frames sent via AF_PACKET
SOCK_RAW. This allows the flow dissector to correctly identify the inner
transport header instead of failing and leaving the transport header unset.
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index 0e1355be89f64..a62d445047c0e 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -1945,9 +1945,15 @@ static void packet_parse_headers(struct sk_buff *skb, struct socket *sock)
>
> /* Move network header to the right position for VLAN tagged packets */
> if (likely(skb->dev->type == ARPHRD_ETHER) &&
> - eth_type_vlan(skb->protocol) &&
> - vlan_get_protocol_and_depth(skb, skb->protocol, &depth) != 0)
> - skb_set_network_header(skb, depth);
> + eth_type_vlan(skb->protocol)) {
> + __be16 proto = vlan_get_protocol_and_depth(skb, skb->protocol,
> + &depth);
> +
> + if (proto != 0) {
> + skb_set_network_header(skb, depth);
> + skb->protocol = proto;
[Severity: High]
Does overwriting skb->protocol here hide the inline VLAN tag from the network
stack and drivers?
Since the VLAN tag is left inline in the MAC payload, updating skb->protocol
to the inner protocol (e.g. ETH_P_IP) causes eth_type_vlan(skb->protocol) to
become false.
This can lead to vlan_features_check() being bypassed, which might allow the
stack to send VLAN packets to a driver with TSO enabled even if the hardware
doesn't support it.
Additionally, drivers like ixgbe that check for ETH_P_8021Q might fail to
recognize the inline software VLAN tag, potentially causing issues like
inserting duplicate VLAN tags when DCB is enabled or breaking egress TC filters.
> + }
> + }
>
> skb_probe_transport_header(skb);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260805105314.3882595-1-wei.fang@oss.nxp.com?part=1
next prev parent reply other threads:[~2026-08-06 10:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 10:53 [PATCH net 0/2] net: fix skb->protocol not updated after VLAN network header adjustment wei.fang
2026-08-05 10:53 ` [PATCH net 1/2] net: packet: " wei.fang
2026-08-06 10:49 ` sashiko-bot [this message]
2026-08-05 10:53 ` [PATCH net 2/2] net: tap: " wei.fang
2026-08-05 12:48 ` Willem de Bruijn
2026-08-06 2:10 ` Wei Fang
2026-08-06 10:06 ` Wei Fang
2026-08-06 14:12 ` Willem de Bruijn
2026-08-07 2:21 ` Wei Fang
2026-08-06 10:49 ` sashiko-bot
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=20260806105000.5B9B71F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wei.fang@oss.nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.