From: Nikolay Aleksandrov <razor@blackwall.org>
To: netdev@vger.kernel.org
Cc: idosch@nvidia.com, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
bridge@lists.linux.dev, Nikolay Aleksandrov <razor@blackwall.org>
Subject: [PATCH net-next 2/9] net: bridge: vlan: annotate lockless pvid use
Date: Tue, 1 Sep 2026 15:07:14 +0300 [thread overview]
Message-ID: <20260901120721.747908-3-razor@blackwall.org> (raw)
In-Reply-To: <20260901120721.747908-1-razor@blackwall.org>
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>
---
net/bridge/br_private.h | 2 +-
net/bridge/br_vlan.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 5b2c22ad669e..0efd2e79e255 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -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)
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 2ae6ffb23399..a53054fcc093 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -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.
--
2.47.3
next prev parent reply other threads:[~2026-09-01 12:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 12:07 [PATCH net-next 0/9] net: bridge: vlan: minor cleanups and annotations Nikolay Aleksandrov
2026-09-01 12:07 ` [PATCH net-next 1/9] net: bridge: vlan: drop legacy memory barriers Nikolay Aleksandrov
2026-09-01 12:07 ` Nikolay Aleksandrov [this message]
2026-09-01 12:07 ` [PATCH net-next 3/9] net: bridge: mst: use br_get_pvid helper Nikolay Aleksandrov
2026-09-01 12:07 ` [PATCH net-next 4/9] net: bridge: vlan: annotate lockless vlan flags use Nikolay Aleksandrov
2026-09-01 12:07 ` [PATCH net-next 5/9] net: bridge: vlan: annotate lockless use of private flags Nikolay Aleksandrov
2026-09-01 12:07 ` [PATCH net-next 6/9] net: bridge: vlan: annotate lockless use of num_vlans Nikolay Aleksandrov
2026-09-01 12:07 ` [PATCH net-next 7/9] net: bridge: vlan: annotate lockless use of msti Nikolay Aleksandrov
2026-09-01 12:07 ` [PATCH net-next 8/9] net: bridge: vlan: add missing tinfo.tunnel_id annotations Nikolay Aleksandrov
2026-09-01 12:07 ` [PATCH net-next 9/9] net: bridge: vlan: use br_vlan_get_state to get vlan state Nikolay Aleksandrov
2026-09-02 17:22 ` [PATCH net-next 0/9] net: bridge: vlan: minor cleanups and annotations Nikolay Aleksandrov
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=20260901120721.747908-3-razor@blackwall.org \
--to=razor@blackwall.org \
--cc=bridge@lists.linux.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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