Skip to content

Commit 8f49c27

Browse files
committed
tcp: Don't change unlocked socket state in tcp_v4_err().
Alexey Kuznetsov noticed a regression introduced by commit f1ecd5d ("Revert Backoff [v3]: Revert RTO on ICMP destination unreachable") The RTO and timer modification code added to tcp_v4_err() doesn't check sock_owned_by_user(), which if true means we don't have exclusive access to the socket and therefore cannot modify it's critical state. Just skip this new code block if sock_owned_by_user() is true and eliminate the now superfluous sock_owned_by_user() code block contained within. Reported-by: Alexey Kuznetsov <[email protected]> Signed-off-by: David S. Miller <[email protected]> CC: Damian Lukowski <[email protected]> Acked-by: Eric Dumazet <[email protected]>
1 parent 5ef4130 commit 8f49c27

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

net/ipv4/tcp_ipv4.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,9 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
415415
!icsk->icsk_backoff)
416416
break;
417417

418+
if (sock_owned_by_user(sk))
419+
break;
420+
418421
icsk->icsk_backoff--;
419422
inet_csk(sk)->icsk_rto = __tcp_set_rto(tp) <<
420423
icsk->icsk_backoff;
@@ -429,11 +432,6 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
429432
if (remaining) {
430433
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
431434
remaining, TCP_RTO_MAX);
432-
} else if (sock_owned_by_user(sk)) {
433-
/* RTO revert clocked out retransmission,
434-
* but socket is locked. Will defer. */
435-
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
436-
HZ/20, TCP_RTO_MAX);
437435
} else {
438436
/* RTO revert clocked out retransmission.
439437
* Will retransmit now */

0 commit comments

Comments
 (0)