summaryrefslogtreecommitdiff
path: root/net/ipv4/proc.c
diff options
context:
space:
mode:
authorKuniyuki Iwashima <kuniyu@amazon.com>2022-07-13 23:51:51 +0300
committerDavid S. Miller <davem@davemloft.net>2022-07-15 13:49:55 +0300
commit8281b7ec5c56b71cb2cc5a1728b41607be66959c (patch)
tree1c9563f175e6e4528ca2f2d33256c18efca097bb /net/ipv4/proc.c
parentdb886979683a8360ced9b24ab1125ad0c4d2cf76 (diff)
downloadlinux-8281b7ec5c56b71cb2cc5a1728b41607be66959c.tar.xz
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/ipv4/proc.c')
-rw-r--r--net/ipv4/proc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 28836071f0a6..0088a4c64d77 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -387,7 +387,7 @@ static int snmp_seq_show_ipstats(struct seq_file *seq, void *v)
seq_printf(seq, "\nIp: %d %d",
IPV4_DEVCONF_ALL(net, FORWARDING) ? 1 : 2,
- net->ipv4.sysctl_ip_default_ttl);
+ READ_ONCE(net->ipv4.sysctl_ip_default_ttl));
BUILD_BUG_ON(offsetof(struct ipstats_mib, mibs) != 0);
snmp_get_cpu_field64_batch(buff64, snmp4_ipstats_list,