Skip to content

Commit 85225e6

Browse files
q2vendavem330
authored andcommitted
tcp: Fix a data-race around sysctl_tcp_autocorking.
While reading sysctl_tcp_autocorking, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: f54b311 ("tcp: auto corking") Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1330ffa commit 85225e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv4/tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ static bool tcp_should_autocork(struct sock *sk, struct sk_buff *skb,
686686
int size_goal)
687687
{
688688
return skb->len < size_goal &&
689-
sock_net(sk)->ipv4.sysctl_tcp_autocorking &&
689+
READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_autocorking) &&
690690
!tcp_rtx_queue_empty(sk) &&
691691
refcount_read(&sk->sk_wmem_alloc) > skb->truesize &&
692692
tcp_skb_can_collapse_to(skb);

0 commit comments

Comments
 (0)