diff options
author | Song Liu <songliubraving@fb.com> | 2018-02-06 23:50:23 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-07 22:00:42 -0500 |
commit | 5c487bb9adddbc1d23433e09d2548759375c2b52 (patch) | |
tree | 83ff74b2e6d19b9a60b67872f718f9fa630319ed /net/ipv4/tcp_ipv4.c | |
parent | 043e337f555e610ad8237fd23522d97c968d72b9 (diff) |
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: c24b14c46bb8 ("tcp: add tracepoint trace_tcp_send_reset")
Signed-off-by: Song Liu <songliubraving@fb.com>
Reviewed-by: Lawrence Brakmo <brakmo@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 95738aa0d8a6..f8ad397e285e 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -705,7 +705,8 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb) | |||
705 | */ | 705 | */ |
706 | if (sk) { | 706 | if (sk) { |
707 | arg.bound_dev_if = sk->sk_bound_dev_if; | 707 | 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); | ||
709 | } | 710 | } |
710 | 711 | ||
711 | BUILD_BUG_ON(offsetof(struct sock, sk_bound_dev_if) != | 712 | BUILD_BUG_ON(offsetof(struct sock, sk_bound_dev_if) != |