Received: by 10.223.185.116 with SMTP id b49csp5481278wrg; Wed, 7 Mar 2018 12:31:07 -0800 (PST) X-Google-Smtp-Source: AG47ELtf/ftgPSnSSQVyzX1Mpaf4LPVpBQ4kp/GFJXu6VoumtAp3rt8mkcLXNRPqWabIXpziV4Fu X-Received: by 10.98.149.138 with SMTP id c10mr23991390pfk.143.1520454667836; Wed, 07 Mar 2018 12:31:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520454667; cv=none; d=google.com; s=arc-20160816; b=gwTwhwqS8cDIwjXx/+e7Ojs5hJkY/LrP7JnQ+B5bm8Z8D8AOJ7J/8If1FvRDFhoprt 9TX0n4011uGvJEbBK7MIGzF/+34/4sXTb76wHtgf+kMf7WZpTRNCLHvWkZZpBPFeSlT3 8dfcK5a8LTiT0SXb2Vr4rlsbkQ4wCVuygQ0/rBe60jt/gsMqRGJpuUhP2Er/71nbYHgh MsqE72i7H1qpNDLcpA0cCuwlvhcAYQ5oDlOOewtIlY6bW0lZDFbgYAVv+rAZXZv+v5hZ 99f/0u4lxk1EycJbxIW/AAAWO61oPmB090yQeemh7s+FWNIvj9CmHKLPTZ+yJmTTHetH jOCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=cDiD/NSWM0Umn2AUaoPeUFd6mPWMxBHcL4EZ0gkAvXU=; b=I8AdJ76CNr6k8dXXQ1hDhcq7eZU8PCspFjAFuFTuGfo1NfnQDNKWTKjyKAGBRAZA4I p89hVWY8I44CEZESjtVUszzieT3JXB8sew+RdzKQjYlBFpT4iCD3Z4Kj7wtnCEMPm6Wz toetk9y2ZMzEn7YGYqOQqiqHpUCwHp/KcUsdzrdxpgzik5qa74CduM+yo5Rx5nZvc7uR EXT1SzgbHhW8MnjD4HRS/AHeHJYPazvgBNZ8/WKAuq79O/iiqkpEWe8JyMR7UlwZf+cs 2PjkmrqofVkAB/gGAm3rknqurIr7BSkr69VAB5i5mbWmrUEZcH6e5BeyzbX/yBlV7+27 dJxQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34-v6si11804294plz.589.2018.03.07.12.30.53; Wed, 07 Mar 2018 12:31:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964903AbeCGU3v (ORCPT + 99 others); Wed, 7 Mar 2018 15:29:51 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:42464 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964798AbeCGTmb (ORCPT ); Wed, 7 Mar 2018 14:42:31 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9E73E107D; Wed, 7 Mar 2018 19:42:28 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Song Liu , Lawrence Brakmo , "David S. Miller" Subject: [PATCH 4.15 082/122] tcp: tracepoint: only call trace_tcp_send_reset with full socket Date: Wed, 7 Mar 2018 11:38:14 -0800 Message-Id: <20180307191741.121970294@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191729.190879024@linuxfoundation.org> References: <20180307191729.190879024@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Song Liu [ Upstream commit 5c487bb9adddbc1d23433e09d2548759375c2b52 ] 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 Reviewed-by: Lawrence Brakmo Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_ipv4.c | 3 ++- net/ipv6/tcp_ipv6.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -705,7 +705,8 @@ static void tcp_v4_send_reset(const stru */ if (sk) { arg.bound_dev_if = sk->sk_bound_dev_if; - trace_tcp_send_reset(sk, skb); + if (sk_fullsock(sk)) + trace_tcp_send_reset(sk, skb); } BUILD_BUG_ON(offsetof(struct sock, sk_bound_dev_if) != --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -943,7 +943,8 @@ static void tcp_v6_send_reset(const stru if (sk) { oif = sk->sk_bound_dev_if; - trace_tcp_send_reset(sk, skb); + if (sk_fullsock(sk)) + trace_tcp_send_reset(sk, skb); } tcp_v6_send_response(sk, skb, seq, ack_seq, 0, 0, 0, oif, key, 1, 0, 0);