vlan: annotate data-races in vlan_dev_priv fields

vlan->flags, vlan->ingress_priority_map[] and vlan->nr_*_mappings
are written under RTNL, but read from lockless contexts:

- the RX path reads vlan->flags (VLAN_FLAG_REORDER_HDR) and
  the ingress priority map,
- the TX path reads vlan->flags,
- /proc/net/vlan/<dev> reads vlan->flags and the ingress priority
  map,
- vlan_get_size() reads vlan->nr_*_mappings,
- vlan_fill_info() will soon run without RTNL.

Add the missing READ_ONCE()/WRITE_ONCE() annotations.

vlan_dev_change_flags() is also made a bit more readable by using
a local new_flags variable, avoiding the repeated re-reads of
vlan->flags after it has been published.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260916132532.1785657-2-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Eric Dumazet 2026-09-16 13:25:31 +00:00 • committed by Jakub Kicinski
commit ca6ff8dd70
5 changed files with 35 additions and 28 deletions