* [PATCH net v2] ipv6: use READ_ONCE() in ipv6_flowlabel_get()
@ 2026-06-02 0:25 Runyu Xiao
2026-06-04 10:20 ` Ido Schimmel
0 siblings, 1 reply; 2+ messages in thread
From: Runyu Xiao @ 2026-06-02 0:25 UTC (permalink / raw)
To: davem, kuba, pabeni
Cc: dsahern, idosch, edumazet, horms, david.laight.linux, netdev,
linux-kernel, jianhao.xu, runyu.xiao
ipv6_flowlabel_get() reads flowlabel_consistency and
flowlabel_state_ranges locklessly.
Use READ_ONCE() for these sysctl accesses.
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
v2:
- Shorten the commit message per review feedback
- Drop the Fixes and stable CC trailers
net/ipv6/ip6_flowlabel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index b1ccdf0dc646..1ab5ad0dcf24 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -620,7 +620,7 @@ static int ipv6_flowlabel_get(struct sock *sk, struct in6_flowlabel_req *freq,
int err;
if (freq->flr_flags & IPV6_FL_F_REFLECT) {
- if (net->ipv6.sysctl.flowlabel_consistency) {
+ if (READ_ONCE(net->ipv6.sysctl.flowlabel_consistency)) {
net_info_ratelimited("Can not set IPV6_FL_F_REFLECT if flowlabel_consistency sysctl is enable\n");
return -EPERM;
}
@@ -633,7 +633,7 @@ static int ipv6_flowlabel_get(struct sock *sk, struct in6_flowlabel_req *freq,
if (freq->flr_label & ~IPV6_FLOWLABEL_MASK)
return -EINVAL;
- if (net->ipv6.sysctl.flowlabel_state_ranges &&
+ if (READ_ONCE(net->ipv6.sysctl.flowlabel_state_ranges) &&
(freq->flr_label & IPV6_FLOWLABEL_STATELESS_FLAG))
return -ERANGE;
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net v2] ipv6: use READ_ONCE() in ipv6_flowlabel_get()
2026-06-02 0:25 [PATCH net v2] ipv6: use READ_ONCE() in ipv6_flowlabel_get() Runyu Xiao
@ 2026-06-04 10:20 ` Ido Schimmel
0 siblings, 0 replies; 2+ messages in thread
From: Ido Schimmel @ 2026-06-04 10:20 UTC (permalink / raw)
To: Runyu Xiao
Cc: davem, kuba, pabeni, dsahern, edumazet, horms, david.laight.linux,
netdev, linux-kernel, jianhao.xu
On Tue, Jun 02, 2026 at 08:25:06AM +0800, Runyu Xiao wrote:
> ipv6_flowlabel_get() reads flowlabel_consistency and
> flowlabel_state_ranges locklessly.
>
> Use READ_ONCE() for these sysctl accesses.
>
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
For net-next:
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-04 10:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02 0:25 [PATCH net v2] ipv6: use READ_ONCE() in ipv6_flowlabel_get() Runyu Xiao
2026-06-04 10:20 ` Ido Schimmel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox