Skip to content

Commit 5c487bb

Browse files
liu-song-6davem330
authored andcommitted
tcp: tracepoint: only call trace_tcp_send_reset with full socket
tracepoint tcp_send_reset requires a full socket to work. However, it may be called when in TCP_TIME_WAIT: case TCP_TW_RST: tcp_v6_send_reset(sk, skb); inet_twsk_deschedule_put(inet_twsk(sk)); goto discard_it; To avoid this problem, this patch checks the socket with sk_fullsock() before calling trace_tcp_send_reset(). Fixes: c24b14c ("tcp: add tracepoint trace_tcp_send_reset") Signed-off-by: Song Liu <[email protected]> Reviewed-by: Lawrence Brakmo <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 043e337 commit 5c487bb

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

net/ipv4/tcp_ipv4.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,8 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb)
705705
*/
706706
if (sk) {
707707
arg.bound_dev_if = sk->sk_bound_dev_if;
708-
trace_tcp_send_reset(sk, skb);
708+
if (sk_fullsock(sk))
709+
trace_tcp_send_reset(sk, skb);
709710
}
710711

711712
BUILD_BUG_ON(offsetof(struct sock, sk_bound_dev_if) !=

net/ipv6/tcp_ipv6.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,8 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb)
942942

943943
if (sk) {
944944
oif = sk->sk_bound_dev_if;
945-
trace_tcp_send_reset(sk, skb);
945+
if (sk_fullsock(sk))
946+
trace_tcp_send_reset(sk, skb);
946947
}
947948

948949
tcp_v6_send_response(sk, skb, seq, ack_seq, 0, 0, 0, oif, key, 1, 0, 0);

0 commit comments

Comments
 (0)