From: Jakub Kicinski <kuba@kernel.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, eric.dumazet@gmail.com,
Tangxin Xie <xietangxin@h-partners.com>
Subject: Re: [PATCH net] vlan: fix skb_under_panic() and races when toggling HW VLAN offload
Date: Thu, 23 Jul 2026 09:22:03 -0700 [thread overview]
Message-ID: <20260723092203.5b1470f5@kernel.org> (raw)
In-Reply-To: <20260720072622.3541873-1-edumazet@google.com>
On Mon, 20 Jul 2026 07:26:22 +0000 Eric Dumazet wrote:
> Toggling hardware VLAN TX offload (NETIF_F_HW_VLAN_CTAG_TX or
> NETIF_F_HW_VLAN_STAG_TX) on a lower device invokes vlan_transfer_features(),
> which dynamically changes vlandev->hard_header_len.
>
> This causes two issues:
> 1. Lockless TX paths (e.g. packet_snd in af_packet.c, ip6_finish_output2)
> read dev->hard_header_len without holding RTNL lock. Mutating
> hard_header_len dynamically under RTNL creates a data race where upper
> layers reserve insufficient headroom based on a stale hard_header_len,
> resulting in skb_under_panic when vlan_dev_hard_header() is called.
> 2. In addition, vlan_transfer_features() updated hard_header_len without
> updating header_ops, causing a mismatch between allocated headroom
> and header creation.
>
> A VLAN interface may require software VLAN header insertion at any point
> (e.g., if reorder_hdr is disabled or HW offload is unavailable). Always
> setting hard_header_len = real_dev->hard_header_len + VLAN_HLEN and using
> vlan_header_ops unconditionally ensures sufficient headroom is reserved
> by all upper layers and avoids any data race on hard_header_len during ETHTOOL
> feature changes.
Hi Eric,
Looks like this broke VXLAN tests:
https://netdev-ctrl.bots.linux.dev/logview.html?f=/logs/vmksft/net/results/742304/2-test-vxlan-mdb-sh/stdout
AI bot says:
The NIPA CI detected a regression introduced by this patch in the VXLAN
MDB selftest (tools/testing/selftests/net/test_vxlan_mdb.sh).
All data path forwarding sub-tests fail on both normal and debug kernel
builds, while the control path (MDB entry add/replace/delete) tests
continue to pass. The failure is 100% reproducible across both runs.
The test topology uses VLAN subinterfaces (br0.10, br0.20) on a bridge
that has a VXLAN device as a member. mausezahn injects multicast frames
from the VLAN subinterface and tc ingress filters on the peer namespace
count packet arrivals to verify forwarding.
With this patch, `vlan_passthru_header_ops` has been removed and all
VLAN devices now unconditionally use `vlan_header_ops`, which calls
`vlan_dev_hard_header()` and inserts an 802.1Q VLAN header in software.
Previously, when the underlying device had `NETIF_F_HW_VLAN_CTAG_TX`
set (as veth does), the passthrough header ops were used and no software
VLAN tag was inserted.
This change causes frames injected from VLAN subinterfaces in the test
to arrive at the peer with an unexpected software-inserted VLAN tag,
breaking the tc filter matches used to verify delivery. Tests that check
frames are *dropped* still pass (the frames never arrive regardless),
but tests that check frames are *forwarded* all fail.
Failing test output excerpt:
TEST: Destination IP - match [FAIL]
TEST: Destination IP - no match [FAIL]
TEST: Forward valid source - first VTEP [FAIL]
TEST: Forward valid source - second VTEP [FAIL]
...
The pattern holds for all four overlay/underlay combinations (IPv4/IPv6
× IPv4/IPv6).
Could you please take a look? It seems the unconditional software VLAN
insertion breaks the VXLAN MDB data path when veth (or similarly capable)
devices are used as the underlay.
next prev parent reply other threads:[~2026-07-23 16:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 7:26 [PATCH net] vlan: fix skb_under_panic() and races when toggling HW VLAN offload Eric Dumazet
2026-07-23 16:22 ` Jakub Kicinski [this message]
2026-07-23 18:20 ` 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=20260723092203.5b1470f5@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=horms@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=xietangxin@h-partners.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