mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 03:27:30 -04:00
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>
This commit is contained in:
committed by
Jakub Kicinski
parent
7a20eb5422
commit
f425c55cb6
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user