tcp: Fix data-races around sysctl_tcp_reflect_tos.
authorKuniyuki Iwashima <kuniyu@amazon.com>
Fri, 22 Jul 2022 18:22:04 +0000 (11:22 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Aug 2022 10:03:52 +0000 (12:03 +0200)
commiteaccca7a0bb8770d2683e817ae6d72dad2b3d5d5
tree377d27c0e10a0786c442773d09a46662897b5d77
parent4cc070e0ef2d212780028b62d8eb286c098c3e9c
tcp: Fix data-races around sysctl_tcp_reflect_tos.

[ Upstream commit 870e3a634b6a6cb1543b359007aca73fe6a03ac5 ]

While reading sysctl_tcp_reflect_tos, it can be changed concurrently.
Thus, we need to add READ_ONCE() to its readers.

Fixes: ac8f1710c12b ("tcp: reflect tos value received in SYN to the socket")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Acked-by: Wei Wang <weiwan@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/tcp_ipv4.c
net/ipv6/tcp_ipv6.c