ipv4: Fix a data-race around sysctl_fib_sync_mem.
authorKuniyuki Iwashima <kuniyu@amazon.com>
Wed, 6 Jul 2022 23:40:03 +0000 (16:40 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Jul 2022 19:24:22 +0000 (21:24 +0200)
commit9be8aac91960ea32fd0e874758c9afee665c57d2
tree5c2c4e6d32b0b9048e416a5da0c8af8825992163
parente2828e8c605853f71267825c9415437c0a93e4f2
ipv4: Fix a data-race around sysctl_fib_sync_mem.

[ Upstream commit 73318c4b7dbd0e781aaababff17376b2894745c0 ]

While reading sysctl_fib_sync_mem, it can be changed concurrently.
So, we need to add READ_ONCE() to avoid a data-race.

Fixes: 9ab948a91b2c ("ipv4: Allow amount of dirty memory from fib resizing to be controllable")
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>
net/ipv4/fib_trie.c