提交 9dfcb801 编写于 作者: K Kuniyuki Iwashima 提交者: Zheng Zengkai

icmp: Fix a data-race around sysctl_icmp_ratemask.

stable inclusion
from stable-v5.10.132
commit 38d78c7b4be7759555d45181213a7845aad279e2
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5YS3T

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=38d78c7b4be7759555d45181213a7845aad279e2

--------------------------------

[ Upstream commit 1ebcb25a ]

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

Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Signed-off-by: NKuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 c5e64441
...@@ -290,7 +290,7 @@ static bool icmpv4_mask_allow(struct net *net, int type, int code) ...@@ -290,7 +290,7 @@ static bool icmpv4_mask_allow(struct net *net, int type, int code)
return true; return true;
/* Limit if icmp type is enabled in ratemask. */ /* Limit if icmp type is enabled in ratemask. */
if (!((1 << type) & net->ipv4.sysctl_icmp_ratemask)) if (!((1 << type) & READ_ONCE(net->ipv4.sysctl_icmp_ratemask)))
return true; return true;
return false; return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册