Skip to content

Commit 02ca527

Browse files
q2vendavem330
authored andcommitted
tcp: Fix a data-race around sysctl_tcp_app_win.
While reading sysctl_tcp_app_win, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 58ebb1c commit 02ca527

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv4/tcp_input.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb,
534534
*/
535535
static void tcp_init_buffer_space(struct sock *sk)
536536
{
537-
int tcp_app_win = sock_net(sk)->ipv4.sysctl_tcp_app_win;
537+
int tcp_app_win = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_app_win);
538538
struct tcp_sock *tp = tcp_sk(sk);
539539
int maxwin;
540540

0 commit comments

Comments
 (0)