While reading sysctl_tcp_adv_win_scale, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader.
Unified · Split
| @@ -1419,7 +1419,7 @@ void tcp_select_initial_window(const struct sock *sk, int __space, · 1418 unmodified lines | |||
| 1419 | 1419 | ||
| 1420 | static inline int tcp_win_from_space(const struct sock *sk, int space) | 1420 | static inline int tcp_win_from_space(const struct sock *sk, int space) |
| 1421 | { | 1421 | { |
| 1422 | int tcp_adv_win_scale = sock_net(sk)->ipv4.sysctl_tcp_adv_win_scale; | 1422 | int tcp_adv_win_scale = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_adv_win_scale); |
| 1423 | 1423 | ||
| 1424 | return tcp_adv_win_scale <= 0 ? | 1424 | return tcp_adv_win_scale <= 0 ? |
| 1425 | (space>>(-tcp_adv_win_scale)) : | 1425 | (space>>(-tcp_adv_win_scale)) : |