net: bridge: vlan: annotate lockless pvid use

Use READ/WRITE_ONCE to annotate lockless pvid use, br_get_pvid() is the
helper that should be used outside of the bridge vlan code. The rest of
the vlan places that access pvid directly all have rtnl.

Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20260903143138.1574598-3-razor@blackwall.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Nikolay Aleksandrov 2026-09-03 17:31:31 +03:00 committed by Jakub Kicinski
parent 581850fa73
commit bd1aeca098
2 changed files with 3 additions and 3 deletions

View File

@ -1687,7 +1687,7 @@ static inline u16 br_get_pvid(const struct net_bridge_vlan_group *vg)
if (!vg)
return 0;
return vg->pvid;
return READ_ONCE(vg->pvid);
}
static inline u16 br_vlan_flags(const struct net_bridge_vlan *v, u16 pvid)

View File

@ -41,7 +41,7 @@ static void __vlan_add_pvid(struct net_bridge_vlan_group *vg,
return;
br_vlan_set_pvid_state(vg, v->state);
vg->pvid = v->vid;
WRITE_ONCE(vg->pvid, v->vid);
}
static void __vlan_delete_pvid(struct net_bridge_vlan_group *vg, u16 vid)
@ -49,7 +49,7 @@ static void __vlan_delete_pvid(struct net_bridge_vlan_group *vg, u16 vid)
if (vg->pvid != vid)
return;
vg->pvid = 0;
WRITE_ONCE(vg->pvid, 0);
}
/* Update the BRIDGE_VLAN_INFO_PVID and BRIDGE_VLAN_INFO_UNTAGGED flags of @v.