diff options
| author | Runyu Xiao <runyu.xiao@seu.edu.cn> | 2026-06-02 03:25:06 +0300 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-06-05 04:31:18 +0300 |
| commit | f425c55cb60e116a53f2c196100dc09c5a828383 (patch) | |
| tree | d73c3f3444f3da7115728d88df16d3eb55260a9a | |
| parent | 7a20eb54224ab7481c1f5a1619a6a5677be93eed (diff) | |
| download | linux-f425c55cb60e116a53f2c196100dc09c5a828383.tar.xz | |
ipv6: use READ_ONCE() in ipv6_flowlabel_get()
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>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20260602002506.1519901-1-runyu.xiao@seu.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
| -rw-r--r-- | net/ipv6/ip6_flowlabel.c | 4 |
1 files 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; |
