diff options
author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2022-08-23 10:46:54 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-08-24 13:46:58 +0100 |
commit | 657b991afb89d25fe6c4783b1b75a8ad4563670d (patch) | |
tree | ae4bf05b7ffa2902b68f902877bb3116fcc58b19 /net/mptcp | |
parent | 2e0c42374ee32e72948559d2ae2f7ba3dc6b977c (diff) | |
download | linux-stable-657b991afb89d25fe6c4783b1b75a8ad4563670d.tar.gz linux-stable-657b991afb89d25fe6c4783b1b75a8ad4563670d.tar.bz2 linux-stable-657b991afb89d25fe6c4783b1b75a8ad4563670d.zip |
net: Fix data-races around sysctl_max_skb_frags.
While reading sysctl_max_skb_frags, it can be changed concurrently.
Thus, we need to add READ_ONCE() to its readers.
Fixes: 5f74f82ea34c ("net:Add sysctl_max_skb_frags")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mptcp')
-rw-r--r-- | net/mptcp/protocol.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index da4257504fad..d398f3810662 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1263,7 +1263,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, i = skb_shinfo(skb)->nr_frags; can_coalesce = skb_can_coalesce(skb, i, dfrag->page, offset); - if (!can_coalesce && i >= sysctl_max_skb_frags) { + if (!can_coalesce && i >= READ_ONCE(sysctl_max_skb_frags)) { tcp_mark_push(tcp_sk(ssk), skb); goto alloc_skb; } |