[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260107033423.1885071-3-chenzhen126@huawei.com>
Date: Wed, 7 Jan 2026 11:34:23 +0800
From: Chen Zhen <chenzhen126@...wei.com>
To: <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>, <horms@...nel.org>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<huyizhen2@...wei.com>, <gaoxingwang1@...wei.com>
Subject: [PATCH v2 net 2/2] selftests: vlan: add test for turn on hw offload with reorder_hdr off
If vlan dev was created with reorder_hdr off and hw offload both
off but up with hw offload on, it will trigger a skb_panic bug in
vlan_dev_hard_header().
Add a test to automatically catch re-occurrence of the issue.
Suggested-by: Jakub Kicinski <kuba@...nel.org>
Signed-off-by: Chen Zhen <chenzhen126@...wei.com>
---
tools/testing/selftests/net/Makefile | 1 +
.../testing/selftests/net/vlan_hw_offload.sh | 30 +++++++++++++++++++
2 files changed, 31 insertions(+)
create mode 100755 tools/testing/selftests/net/vlan_hw_offload.sh
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index b66ba04f19d9..8b50448a01cd 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -113,6 +113,7 @@ TEST_PROGS := \
veth.sh \
vlan_bridge_binding.sh \
vlan_hw_filter.sh \
+ vlan_hw_offload.sh \
vrf-xfrm-tests.sh \
vrf_route_leaking.sh \
vrf_strict_mode_test.sh \
diff --git a/tools/testing/selftests/net/vlan_hw_offload.sh b/tools/testing/selftests/net/vlan_hw_offload.sh
new file mode 100755
index 000000000000..5c49cc2525f2
--- /dev/null
+++ b/tools/testing/selftests/net/vlan_hw_offload.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+setup() {
+ ip link add veth0 type veth peer name veth1
+ ip link set veth0 up
+ ip link set veth1 up
+}
+
+cleanup() {
+ ip link delete veth0 2>/dev/null
+}
+
+#turn on hw offload and set up vlan dev with reorder_hdr off
+test_vlan_hw_offload_toggle_crash() {
+ ethtool -K veth0 tx-vlan-hw-insert off
+ ip link add link veth0 name veth0.10 type vlan id 10 reorder_hdr off
+ ethtool -K veth0 tx-vlan-hw-insert on
+
+ # set up vlan dev and it will trigger ndisc
+ ip link set veth0.10 up
+ ip -6 route show dev veth0.10
+}
+
+trap cleanup EXIT
+
+setup
+test_vlan_hw_offload_toggle_crash
+
+exit 0
--
2.33.0
Powered by blists - more mailing lists