提交 db27a46c 编写于 作者: K Kuniyuki Iwashima 提交者: Yongqiang Liu

tcp: Fix a data-race around sysctl_tcp_challenge_ack_limit.

stable inclusion
from stable-v4.19.255
commit 3bf8415f605526a7eea9f3f7d7e30d8867b2cd1e
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5Q0SQ
CVE: NA

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

commit db3815a2 upstream.

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

Fixes: 282f23c6 ("tcp: implement RFC 5961 3.2")
Signed-off-by: NKuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 2ab08dad
...@@ -3471,7 +3471,7 @@ static void tcp_send_challenge_ack(struct sock *sk, const struct sk_buff *skb) ...@@ -3471,7 +3471,7 @@ static void tcp_send_challenge_ack(struct sock *sk, const struct sk_buff *skb)
/* Then check host-wide RFC 5961 rate limit. */ /* Then check host-wide RFC 5961 rate limit. */
now = jiffies / HZ; now = jiffies / HZ;
if (now != challenge_timestamp) { if (now != challenge_timestamp) {
u32 ack_limit = net->ipv4.sysctl_tcp_challenge_ack_limit; u32 ack_limit = READ_ONCE(net->ipv4.sysctl_tcp_challenge_ack_limit);
u32 half = (ack_limit + 1) >> 1; u32 half = (ack_limit + 1) >> 1;
challenge_timestamp = now; challenge_timestamp = now;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册