]> git.itanic.dy.fi Git - linux-stable/commit
ratelimit: Fix data-races in ___ratelimit().
authorKuniyuki Iwashima <kuniyu@amazon.com>
Tue, 23 Aug 2022 17:46:48 +0000 (10:46 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Sep 2022 08:23:55 +0000 (10:23 +0200)
commit509c21ea2776fff3f17558fd4b7da34db208eda0
tree7921d8e57f88384aac4568095b0d6b5a2c42f00e
parent3cfdaa30d3e28feaab484cdd83aab6b763c0fbd6
ratelimit: Fix data-races in ___ratelimit().

[ Upstream commit 6bae8ceb90ba76cdba39496db936164fa672b9be ]

While reading rs->interval and rs->burst, they can be changed
concurrently via sysctl (e.g. net_ratelimit_state).  Thus, we
need to add READ_ONCE() to their 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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
lib/ratelimit.c