File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1519,9 +1519,12 @@ static inline int keepalive_intvl_when(const struct tcp_sock *tp)
1519
1519
static inline int keepalive_time_when (const struct tcp_sock * tp )
1520
1520
{
1521
1521
struct net * net = sock_net ((struct sock * )tp );
1522
+ int val ;
1522
1523
1523
- return tp -> keepalive_time ? :
1524
- READ_ONCE (net -> ipv4 .sysctl_tcp_keepalive_time );
1524
+ /* Paired with WRITE_ONCE() in tcp_sock_set_keepidle_locked() */
1525
+ val = READ_ONCE (tp -> keepalive_time );
1526
+
1527
+ return val ? : READ_ONCE (net -> ipv4 .sysctl_tcp_keepalive_time );
1525
1528
}
1526
1529
1527
1530
static inline int keepalive_probes (const struct tcp_sock * tp )
Original file line number Diff line number Diff line change @@ -3418,7 +3418,8 @@ int tcp_sock_set_keepidle_locked(struct sock *sk, int val)
3418
3418
if (val < 1 || val > MAX_TCP_KEEPIDLE )
3419
3419
return - EINVAL ;
3420
3420
3421
- tp -> keepalive_time = val * HZ ;
3421
+ /* Paired with WRITE_ONCE() in keepalive_time_when() */
3422
+ WRITE_ONCE (tp -> keepalive_time , val * HZ );
3422
3423
if (sock_flag (sk , SOCK_KEEPOPEN ) &&
3423
3424
!((1 << sk -> sk_state ) & (TCPF_CLOSE | TCPF_LISTEN ))) {
3424
3425
u32 elapsed = keepalive_time_elapsed (tp );
You can’t perform that action at this time.
0 commit comments