diff options
author | Kuniyuki Iwashima | 2022-07-13 13:51:54 -0700 |
---|---|---|
committer | David S. Miller | 2022-07-15 11:49:55 +0100 |
commit | 7bf9e18d9a5e99e3c83482973557e9f047b051e7 (patch) | |
tree | 7f30b756947599df61a8d23ca811eeafc3e35745 /net/ipv4/ip_forward.c | |
parent | 60c158dc7b1f0558f6cadd5b50d0386da0000d50 (diff) |
ip: Fix data-races around sysctl_ip_fwd_update_priority.
While reading sysctl_ip_fwd_update_priority, it can be changed
concurrently. Thus, we need to add READ_ONCE() to its readers.
Fixes: 432e05d32892 ("net: ipv4: Control SKB reprioritization after forwarding")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_forward.c')
-rw-r--r-- | net/ipv4/ip_forward.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c index e3aa436a1bdf..e18931a6d153 100644 --- a/net/ipv4/ip_forward.c +++ b/net/ipv4/ip_forward.c @@ -157,7 +157,7 @@ int ip_forward(struct sk_buff *skb) !skb_sec_path(skb)) ip_rt_send_redirect(skb); - if (net->ipv4.sysctl_ip_fwd_update_priority) + if (READ_ONCE(net->ipv4.sysctl_ip_fwd_update_priority)) skb->priority = rt_tos2priority(iph->tos); return NF_HOOK(NFPROTO_IPV4, NF_INET_FORWARD, |