summaryrefslogtreecommitdiff
path: root/net/netfilter/nf_synproxy_core.c
diff options
context:
space:
mode:
authorKuniyuki Iwashima <kuniyu@amazon.com>2022-07-13 13:51:51 -0700
committerDavid S. Miller <davem@davemloft.net>2022-07-15 11:49:55 +0100
commit8281b7ec5c56b71cb2cc5a1728b41607be66959c (patch)
tree1c9563f175e6e4528ca2f2d33256c18efca097bb /net/netfilter/nf_synproxy_core.c
parentdb886979683a8360ced9b24ab1125ad0c4d2cf76 (diff)
ip: Fix data-races around sysctl_ip_default_ttl.
While reading sysctl_ip_default_ttl, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netfilter/nf_synproxy_core.c')
-rw-r--r--net/netfilter/nf_synproxy_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netfilter/nf_synproxy_core.c b/net/netfilter/nf_synproxy_core.c
index e479dd0561c5..16915f8eef2b 100644
--- a/net/netfilter/nf_synproxy_core.c
+++ b/net/netfilter/nf_synproxy_core.c
@@ -405,7 +405,7 @@ synproxy_build_ip(struct net *net, struct sk_buff *skb, __be32 saddr,
iph->tos = 0;
iph->id = 0;
iph->frag_off = htons(IP_DF);
- iph->ttl = net->ipv4.sysctl_ip_default_ttl;
+ iph->ttl = READ_ONCE(net->ipv4.sysctl_ip_default_ttl);
iph->protocol = IPPROTO_TCP;
iph->check = 0;
iph->saddr = saddr;