diff options
author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2022-07-13 13:51:53 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-07-29 17:10:31 +0200 |
commit | eb15262128b793e4b1d1c4514d3e6d19c3959764 (patch) | |
tree | f3b5723e8b38d7a3abb3e396b90ebbe91622711b /include/net | |
parent | 17f5417194136517ee9bbd6511249e5310e5617c (diff) | |
download | linux-stable-eb15262128b793e4b1d1c4514d3e6d19c3959764.tar.gz linux-stable-eb15262128b793e4b1d1c4514d3e6d19c3959764.tar.bz2 linux-stable-eb15262128b793e4b1d1c4514d3e6d19c3959764.zip |
ip: Fix data-races around sysctl_ip_fwd_use_pmtu.
[ Upstream commit 60c158dc7b1f0558f6cadd5b50d0386da0000d50 ]
While reading sysctl_ip_fwd_use_pmtu, it can be changed concurrently.
Thus, we need to add READ_ONCE() to its readers.
Fixes: f87c10a8aa1e ("ipv4: introduce ip_dst_mtu_maybe_forward and protect forwarding path against pmtu spoofing")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/ip.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/ip.h b/include/net/ip.h index d1a4efedbc03..471463bfe6f9 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -402,7 +402,7 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst, struct net *net = dev_net(dst->dev); unsigned int mtu; - if (net->ipv4.sysctl_ip_fwd_use_pmtu || + if (READ_ONCE(net->ipv4.sysctl_ip_fwd_use_pmtu) || ip_mtu_locked(dst) || !forwarding) return dst_mtu(dst); |