diff options
| author | Kuniyuki Iwashima <[email protected]> | 2022-08-23 17:46:54 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2022-08-24 12:46:58 +0000 |
| commit | 657b991afb89d25fe6c4783b1b75a8ad4563670d (patch) | |
| tree | ae4bf05b7ffa2902b68f902877bb3116fcc58b19 /net/ipv4/tcp.c | |
| parent | net: Fix a data-race around netdev_budget. (diff) | |
| download | kernel-657b991afb89d25fe6c4783b1b75a8ad4563670d.tar.gz kernel-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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/ipv4/tcp.c')
| -rw-r--r-- | net/ipv4/tcp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index bbe218753662..e5011c136fdb 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -1000,7 +1000,7 @@ new_segment: i = skb_shinfo(skb)->nr_frags; can_coalesce = skb_can_coalesce(skb, i, page, offset); - if (!can_coalesce && i >= sysctl_max_skb_frags) { + if (!can_coalesce && i >= READ_ONCE(sysctl_max_skb_frags)) { tcp_mark_push(tp, skb); goto new_segment; } @@ -1354,7 +1354,7 @@ new_segment: if (!skb_can_coalesce(skb, i, pfrag->page, pfrag->offset)) { - if (i >= sysctl_max_skb_frags) { + if (i >= READ_ONCE(sysctl_max_skb_frags)) { tcp_mark_push(tp, skb); goto new_segment; } |
