Article View: linux.kernel.netdev
Article #9275Re: [PATCH net] net: parse the eighth nested VLAN tag
From: netdev-bot+sashiko
Date: Sun, 01 Nov 2026 13:55
Date: Sun, 01 Nov 2026 13:55
105 lines
11637 bytes
11637 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 1 ยท Medium: 0 ยท Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The patch fixes the counter only when mac_len is 0 or covers the
first VLAN header.
--
net: parse the eighth nested VLAN tag
This commit changes the parse_depth check in __vlan_get_protocol_offset()
from a pre-decrement to a post-decrement. The goal is for a packet with
eight nested VLAN tags to return the encapsulated EtherType instead of 0,
while a ninth tag is still rejected.
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 48f6764117243..b10ce1d46674b 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -7703,7 +7703,7 @@ struct vlan_type_depth __vlan_get_protocol_offset(const struct sk_buff *skb,
>
> vh = skb_header_pointer(skb, mac_offset + vlan_depth,
> sizeof(vhdr), &vhdr);
> - if (unlikely(!vh || !--parse_depth))
> + if (unlikely(!vh || !parse_depth--))
> return (struct vlan_type_depth) { 0 };
[Severity: High]
Does this allow eight nested tags for every value of skb->mac_len?
parse_depth goes down once per loop pass, not once per VLAN header that is
actually parsed. What the first pass reads depends on where the loop
starts:
net/core/skbuff.c:__vlan_get_protocol_offset() {
...
if (vlan_depth) {
if (WARN_ON_ONCE(vlan_depth < VLAN_HLEN))
return (struct vlan_type_depth) { 0 };
vlan_depth -= VLAN_HLEN;
} else {
vlan_depth = ETH_HLEN;
}
...
}
With mac_len == 0 or mac_len == ETH_HLEN + VLAN_HLEN, the first pass
parses the first tag, and eight tags now work.
With mac_len == ETH_HLEN and the first tag still in-band, vlan_depth
starts at 10. The first pass reads the last two bytes of the source MAC as
the TCI and the outer TPID as h_vlan_encapsulated_proto. That only re-reads
the type that was passed in.
Eight in-band tags then take nine passes. The ninth pass sees
parse_depth == 0 and returns { 0 }, which is the result the commit message
says is fixed.
The egress path on a device without VLAN TX offload seems to produce this
state:
validate_xmit_vlan()
__vlan_hwaccel_push_inside()
vlan_insert_tag_set_proto()
__vlan_insert_inner_tag()
__vlan_insert_inner_tag() pushes the hwaccel tag inline and moves
skb->mac_header, but it does not update skb->mac_len:
skb_push(skb, VLAN_HLEN);
...
if (skb_mac_header_was_set(skb))
skb->mac_header -= VLAN_HLEN;
A forwarded skb that arrived with mac_len == ETH_HLEN keeps that value. A
later vlan_get_protocol() call, such as one in a driver's xmit checksum
path, would then still get 0 for a frame with eight tags.
On the plain RX path (skb_vlan_untag() followed by skb_reset_mac_len()),
the extra pass happens to line up with the stripped hwaccel tag, so eight
tags still work there.
Could parse_depth be decremented only for passes that parse a real VLAN
header? Alternatively, the start offset could be chosen so that every pass
parses one.
If the current behaviour is kept, should the commit message and the
VLAN_MAX_DEPTH comment mention that the result depends on mac_len? The two
texts in question are "allowing eight nested tags while continuing to
reject a ninth" and "Max. number of nested VLAN tags parsed".
>
> type = vh->h_vlan_encapsulated_proto;
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261031135507.3970551-2-thnkslprpt%40gmail.com
Technical Details
Message-ID:
<179354134078.3131.9650678574145259725@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354234-linux-kernel-netdev=dewy.ruReferences:
<20261031135507.3970551-2-thnkslprpt@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354234-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] net: parse the eighth nested VLAN tag Date: Sun, 01 Nov 2026 13:55:40 +0000 Organization: Usenet Network Message-ID: <179354134078.3131.9650678574145259725@kernel.org> References: <20261031135507.3970551-2-thnkslprpt@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2697063"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:CeyTBvlCwawJKVGIS2PhCm7z6mY= sha256:deCPXPsWaqrLFSUOUIwkMXXYjNMGR6SrXifOSYVHhPU= sha1:e4wtcPKY7Y0dR7mmOL8xXiX8ipY= sha256:ZLSMswdYPMjLU21jxVQ49BhChkFgrRiyT8eRqeuQzcw= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 5D57E114004; Sun, 1 Nov 2026 16:56:16 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qriG97pH0-eN; Sun, 1 Nov 2026 16:56:12 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-354234-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 75245D0948; Sun, 1 Nov 2026 16:56:00 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 5C74C25896; Sun, 1 Nov 2026 13:55:56 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793541353; b=oLJcBZfkvPkhudEzZT1VQ+if8/9XfzjPgyZ6i4QfhmgvVLqR1P7907ATYhitYntthp7Q TexKHPwaXdzCOha9ISXPeYLgIhtgPrC80iUDKwrywHzXyoUCmsTO+i1/U2CP8NLSiOdFE rCdVijKECqky7o5vmd9Z7zTr6+uO+IOcTGrh4sX0GabvQM3GexcSHKuYrH1AUFQUVMpEc tfMTC5AlVIRiJpqODW75d/D2j0yMMzxcqTX5q/05qzEu5eBX9xwj1IOvHd/0+sMzD4Fgd RbhOdIRB5O9sCY/3GwfrH3eBxjjvTZB0gvOfAwhf0xyJ316lEvNrePOy7vw5tL6JaTg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793541353; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=SFHUxyTe9QZ6LESJxwmHaoYtyHUY8quRXCEk8ZG4ceE=; b=G/x0aHT2lAOnEEvzkH9Pgy5OsVevxXki32UYuEauLPBi3pI1qCa4hbOhpRSBX4ZzlU4L iz6tdWR+Z2WVogj3c0s508QWN/9lbMuPLq2kLrIvDgK1UIs0zItCSymIOqV8pXtZQwC2W 8pNJ/3+Cn5214rZxH+fvDMD9/bjox4xErlxvC+nDx3Tz83NWGHwKnp4m/Mj3uUX8esqh5 NzqQz0yHlZdHXerTgQ5YUDdwoaq0HN9CWOxhyeeHd+gT5WnRo49pKknAkJ9sZJFJ1AokT V5A90dWVECvxGWItqWs7ECZhF4Fmhfz0R24vGDSz46N1NnOARM2TQxFYvYj0JCmhCfg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XOqYYifb; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 86BD8606A32E; Sun, 1 Nov 2026 13:55:53 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XOqYYifb X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793541342; b=AVaVcQV9ACY/oufdV0Qp8P8S2KF5wAm6TATpUGzBu2BhXzadZYREnaT2VdEoVGzezeIB HFEHGlMJmnsNRxmGsyM1t/rphY7BDbk8OD6wapPMk1TH8w9yS0oBLY1bzRxsdTrjiPTdY wruxnqozXxsiISxevNdj9mZHpQOc7UXzy5AGF1jGLfQk8McyhE4qdXsRhwPfHjFbw4jXA NZw1619WM5zXe0RxFs6aC7XbN1xRqVco4S39RTyaNkjwLxhs1tHPDUxXxu7gOHksnpQfu WwTcV2E29+irLGEVXmfTZZZ0Iwdodpa17nt9l0bYeTOZ7MC0E0141msM17pluV+z1sw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793541342; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=SFHUxyTe9QZ6LESJxwmHaoYtyHUY8quRXCEk8ZG4ceE=; b=kSd7D6U3Pci8oKuMGPAR5u4sMr5NkNmYGjAgYO297tcqYtnIHcwlz0LaywjN/ndxIwqX ra16jgH0GkFZBKsK920VBuugD4lyy9hSeinHo6IrvsPbsHMVMbcmavWNUcvS22NNByBTi 3pNal1FuW3bxVOP99Cq1uxUumFWVju/64F6dR1lS5xXpj6fVxkPltuje83QS4RpWiFSy7 NIS5DKuQucDGevxMM3D83IdOi4Z+rR8QjOiHYJ5pVw1Y9v3U01KcZKdwi8KRyC6okPdNA nPeGLNUftCi3YdkBiSlXYMeMgMAnqLE10BGewdpQL6zMunDnGtpwfrnGyz0+3nno33A== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XOqYYifb; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E43E606A324; Sun, 1 Nov 2026 13:55:42 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 397501F000C1; Sun, 1 Nov 2026 13:55:41 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793541341; bh=SFHUxyTe9QZ6LESJxwmHaoYtyHUY8quRXCEk8ZG4ceE=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=XOqYYifb+aU+6Q2BqUqC6mJWjn1JXYRoHvgYSH8TPexTqRZkyTU1faOTb+gp5vLNL Ypw5/RI/sVh4Ngr4QA7nadA808wuD7nZ1+eG6hM4EhpZoQM0GO4TfiF0LsEYuv2hzH kwGy98TwemCgg3jXfjwqp9E6/1gOULZRJAusOkiAH3yJ9cTGaxALmy2EdObstxAFGs AUkBeQVT9/amP1V348eGBCTjnbrO29Dt+w8FvYXVowtmeacqEnpI6lFTkhPwE/8bto nE3grNhHiTKC4/JM3TZiF8WalCl8yBM2hDSHyTW5jZHtnOVTxbhas2doLhszlsj7KL bbAsFokwsR27A== X-Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, willemb@google.com, kerneljasonxing@gmail.com, almasrymina@google.com, josef@toxicpanda.com, jiayuan.chen@linux.dev, toke@toke.dk, linux-kernel@vger.kernel.org X-In-Reply-To: <20261031135507.3970551-2-thnkslprpt@gmail.com> X-sashiko-severity: High X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list