linux/Documentation/networking
Jakub Kicinski cd1c188db1 vlan: defer real device state propagation to netdev_work
vlan_device_event() generates nested UP/DOWN, MTU and feature
change events. It executes an event for the VLAN device directly
from the notifier - while the locks of the lower device are held.

This causes deadlocks, for example:

  bond    (3) bond_update_speed_duplex(vlan)
    |           ^                v
  vlan    (2) UP(vlan)    (4) vlan_ethtool_get_link_ksettings()
    |           ^                v
  dummy   (1) UP(dummy)   (5) __ethtool_get_link_ksettings()

The dummy device is ops locked, vlan creates a nested event (2),
then bond wants to ask vlan for link state (3). bond uses the
"I'm already holding the instance lock" flavor of API. But in
this case the lock held refers to vlan itself. We hit vlan's
link settings trampoline (4) and call __ethtool_get_link_ksettings()
which tries to lock dummy. Deadlock. There's no clean way for us
to tell the vlan_ethtool_get_link_ksettings() that the caller
is already in lower device's critical section.

Defer the propagation to the per-netdev work facility instead:
the notifier only schedules netdev_work_sched(vlandev, VLAN_WORK_*),
and ndo_work (vlan_dev_work) applies the change later. Hopefully
nobody expects the VLAN state changes to be instantaneous.

If someone does expect the changes to be instantaneous we will
have to do the same thing Stan did for rx_mode and "strategically"
place sync calls, to make sure such delayed works are executed
after we drop the ops lock but before we drop rtnl_lock.

Stan suggests that if we need that down the line we may
consider reshaping the mechanism into "async notifications".
AFAICT only vlan does this sort of netdev open chaining,
so as a first try I think that sticking the complexity into
the vlan code makes sense.

One corner case is that we need to cancel the event if user
explicitly changes the state before work could run. Consider
the following operations with vlan0 on top of dummy0:

  ip link set dev dummy0 up    # queues work to up vlan0
  ip link set dev vlan0 down   # user explicitly downs the vlan
  ndo_work                     # acts on the stale event

Reported-by: syzbot+09da62a8b78959ceb8bb@syzkaller.appspotmail.com
Reported-by: syzbot+cb67c392b0b8f0fd0fc1@syzkaller.appspotmail.com
Reported-by: syzbot+9bb8bd77f3966641f298@syzkaller.appspotmail.com
Fixes: 9f275c2e90 ("net: ethtool: make sure __ethtool_get_link_ksettings() is ops-locked")
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20260624182018.2445732-4-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-06-25 10:18:40 -07:00
..
device_drivers Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-05-21 15:09:02 -07:00
devlink docs: net: fix minor issues with devlink docs 2026-06-15 15:42:53 -07:00
diagnostic Documentation: use a source-read extension for the index link boilerplate 2026-01-23 11:59:34 -07:00
dsa dt-bindings: net: dsa: Convert lan9303.txt to yaml format 2026-06-13 15:00:07 -07:00
mac80211_hwsim
net_cachelines appletalk: stop storing per-interface state in struct net_device 2026-06-16 14:37:06 -07:00
pse-pd net: pse-pd: Add support for PSE PIs 2024-04-18 18:27:33 -07:00
xfrm xfrm: add documentation for XFRM_MSG_MIGRATE_STATE 2026-06-04 12:22:50 +02:00
6lowpan.rst
af_xdp.rst net: xsk: introduce XDP_MAX_TX_SKB_BUDGET setsockopt 2025-07-10 14:48:29 +02:00
alias.rst
arcnet-hardware.rst docs: net: arcnet: remove outdated/irrelevant information; improve style 2026-05-22 17:20:57 -07:00
arcnet.rst docs: net: arcnet: remove outdated/irrelevant information; improve style 2026-05-22 17:20:57 -07:00
atm.rst
bareudp.rst docs: net: bareudp: fix spelling and grammar mistakes 2024-11-30 13:54:28 -08:00
batman-adv.rst batman-adv: Use consistent name for mesh interface 2025-02-22 11:36:22 +01:00
bonding.rst bonding: 3ad: add lacp_strict configuration knob 2026-06-10 07:53:26 -07:00
bridge.rst docs: net: bridge: document stp_mode attribute 2026-04-10 15:52:25 -07:00
can_ucan_protocol.rst
can.rst linux-can-fixes-for-6.18-20251014 2025-10-15 17:56:20 -07:00
cdc_mbim.rst Fix spelling mistake 2024-11-28 12:08:32 +01:00
checksum-offloads.rst docs: net: render the checksum comment in checksum-offloads.rst 2026-05-28 14:37:47 -07:00
dctcp.rst
devmem.rst docs: net: update devmem code examples 2026-05-28 14:37:46 -07:00
dns_resolver.rst net: dns_resolver: Fix request-key cross-reference 2025-09-26 15:21:38 -07:00
driver.rst docs: networking: add guidance on what to push via extack 2026-06-12 17:55:48 -07:00
eql.rst
ethtool-netlink.rst net: ethtool: add ethtool COALESCE_RX_CQE_FRAMES/NSECS 2026-03-18 20:01:10 -07:00
failover.rst
fib_trie.rst
filter.rst ARC: Add eBPF JIT support 2024-05-12 16:51:36 -07:00
gen_stats.rst
generic_netlink.rst
generic-hdlc.rst
gtp.rst
ieee802154.rst Documentation: ieee802154: fix grammar 2024-10-28 21:14:27 +01:00
ila.rst
index.rst net: remove ax25 and amateur radio (hamradio) subsystem 2026-04-23 10:24:02 -07:00
ioam6-sysctl.rst
iou-zcrx.rst io_uring/zcrx: document area chunking parameter 2026-01-14 02:13:37 +00:00
ip_dynaddr.rst
ip-sysctl.rst tcp: rehash onto different local ECMP path on retransmit timeout 2026-06-15 15:57:31 -07:00
ipsec.rst
ipv6.rst
ipvlan.rst
ipvs-sysctl.rst ipvs: fix doc syntax for conn_max sysctl 2026-06-14 12:51:55 +02:00
iso15765-2.rst Documentation/networking: fix basic node example document ISO 15765-2 2025-02-08 11:28:11 +01:00
j1939.rst can: j1939: Extend stack documentation with buffer size behavior 2025-02-19 11:10:53 +01:00
kapi.rst net-shapers: implement NL get operation 2024-10-10 08:30:22 -07:00
kcm.rst docs/kcm: Fix typo "BFP" 2025-03-24 12:20:42 -07:00
l2tp.rst documentation/networking: update l2tp docs 2024-08-11 04:38:49 +01:00
lapb-module.rst
mac80211-auth-assoc-deauth.txt
mac80211-injection.rst
mctp.rst
mpls-sysctl.rst
mptcp-sysctl.rst mptcp: introduce add_addr_v6_port_drop_ts sysctl knob 2026-06-11 15:33:37 -07:00
mptcp.rst Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-09-11 17:40:13 -07:00
msg_zerocopy.rst docs: net: description of MSG_ZEROCOPY for AF_VSOCK 2023-10-15 13:19:42 +01:00
multi-pf-netdev.rst tools: ynl: move python code to separate sub-directory 2025-01-09 12:53:27 -08:00
multiqueue.rst
napi.rst docs: net: fix minor issues with the NAPI guide 2026-05-28 14:37:46 -07:00
net_dim.rst dim: pass dim_sample to net_dim() by reference 2024-11-03 12:36:54 -08:00
net_failover.rst Documentation: net: net_failover: Separate cloud-ifupdown-helper and reattach-vf.sh code blocks marker 2025-10-17 16:28:29 -07:00
netconsole.rst Documentation: netconsole: Separate literal code blocks for full and short netcat command name versions 2025-10-31 16:54:22 -07:00
netdev-features.rst docs: net: ethtool: document ops-locked drivers and op_needs_rtnl 2026-06-09 10:13:06 -07:00
netdevices.rst vlan: defer real device state propagation to netdev_work 2026-06-25 10:18:40 -07:00
netfilter-sysctl.rst
netif-msg.rst
netmem.rst net: netkit: declare NETMEM_TX_NO_DMA mode 2026-05-18 18:49:06 -07:00
nexthop-group-resilient.rst
nf_conntrack-sysctl.rst netfilter: conntrack: remove DCCP protocol support 2025-07-03 13:51:39 +02:00
nf_flowtable.rst
nfc.rst net: nfc: Format userspace interface subsection headings 2025-10-21 10:57:45 +02:00
oa-tc6-framework.rst Documentation: networking: add OPEN Alliance 10BASE-T1x MAC-PHY serial interface 2024-09-11 20:53:42 -07:00
openvswitch.rst
operstates.rst
packet_mmap.rst docs: networking: packet_mmap: replace dead links with archive.org links 2024-10-28 15:47:10 -07:00
page_pool.rst docs: page_pool: drop the mention of the legacy stats API 2026-05-28 18:10:03 -07:00
phonet.rst
phy-link-topology.rst Documentation: networking: document phy_link_topology 2024-08-23 13:04:35 +01:00
phy-port.rst Documentation: networking: Document the phy_port infrastructure 2026-01-13 18:52:36 -08:00
phy.rst net: phy: remove unused fixup unregistering functions 2026-01-15 19:48:26 -08:00
pktgen.rst
plip.rst
ppp_generic.rst
proc_net_tcp.rst
psp.rst psp: add documentation 2025-09-18 12:32:06 +02:00
radiotap-headers.rst
rds.rst Documentation: Fix networking typos 2025-08-18 10:31:20 -06:00
regulatory.rst
representors.rst Documentation: Add documentation for eswitch attribute 2024-03-28 18:20:08 -07:00
rxrpc.rst Documentation: rxrpc: Demote three sections 2025-09-24 18:12:10 -07:00
scaling.rst net-sysfs: use rps_tag_ptr and remove metadata from rps_sock_flow_table 2026-03-04 16:54:09 -08:00
sctp.rst
secid.rst
seg6-sysctl.rst doc: fix seg6_flowlabel path 2025-10-12 22:51:37 +01:00
segmentation-offloads.rst docs: net: fix minor issues with segmentation offloads 2026-05-28 14:37:47 -07:00
sfp-phylink.rst doc: sfp-phylink: update the porting guide with PCS handling 2024-03-07 15:27:05 +01:00
skbuff.rst docs: net: render the checksum comment in checksum-offloads.rst 2026-05-28 14:37:47 -07:00
smc-sysctl.rst Documentation: net/smc: correct old value of smcr_max_recv_wr 2026-04-27 16:49:39 -07:00
snmp_counter.rst docs: automarkup: linkify git revs 2023-11-17 13:13:24 -07:00
sriov.rst docs: net: document guidance of implementing the SR-IOV NDOs 2024-06-21 10:18:45 +01:00
statistics.rst docs: net: statistics: fix kernel-internal stats list 2026-05-28 14:37:46 -07:00
strparser.rst docs: net: fix minor issues with strparser docs 2026-06-15 15:42:53 -07:00
switchdev.rst net: rename netns_local to netns_immutable 2025-03-04 12:44:48 +01:00
sysfs-tagging.rst
tc-actions-env-rules.rst
tc-queue-filters.rst
tcp_ao.rst Documentation/tcp_ao: Document the supported MAC algorithms and lengths 2026-05-02 10:18:09 -07:00
tcp-thin.rst
team.rst
timestamping.rst net: remove legacy way to get/set HW timestamp config 2026-01-20 18:21:27 -08:00
tipc.rst Documentation: tipc: fix formatting issue in tipc.rst 2024-11-19 11:17:13 +01:00
tls-handshake.rst net/handshake: Fixed grammar mistake 2026-02-27 19:24:08 -08:00
tls-offload-layers.svg
tls-offload-reorder-bad.svg
tls-offload-reorder-good.svg
tls-offload.rst docs: net: tls-offload: document tls_dev_del, tls_dev_resync, and rekey 2026-06-15 15:42:52 -07:00
tls.rst net/tls: support setting the maximum payload size 2025-10-27 16:13:42 -07:00
tproxy.rst docs: tproxy: fix formatting for nft code block 2025-04-29 00:00:26 +02:00
tuntap.rst
udplite.rst
vrf.rst
vxlan.rst
x25-iface.rst
x25.rst
xdp-rx-metadata.rst docs: net: fix minor issues with XDP metadata docs 2026-06-12 15:58:02 -07:00
xsk-tx-metadata.rst docs: net: fix minor issues with XDP metadata docs 2026-06-12 15:58:02 -07:00