Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2028258imu; Fri, 14 Dec 2018 04:45:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/U+ymLnMA7DOHVWyI4PCvIVM1pl2rwjnvGhmgWXMXIePBHBI1j4pT9SZVXLvtUHoDNejbCi X-Received: by 2002:a62:5658:: with SMTP id k85mr2662839pfb.231.1544791514679; Fri, 14 Dec 2018 04:45:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544791514; cv=none; d=google.com; s=arc-20160816; b=g6ZINKK8FdK3PLpGtN3lPAnwA8DwhY/mPHe9hSEQXofmVMlD/Kg6av1XjR+qGis+Rf h+JLef5mGPBhLiCPxtvfC7eFeCbXAKm+4qyLVTJppr4qQ4Ert59zVogW3pKJFxiSrDsb Yo2DmTVjXEfCFOr6BCwLAhQxuErO43uZVyNTOLZKyi8wnjw8cV06UpTjfAp3ApdIPxVV uykqb8iIigA4oMPv0UkukAgynN7Qjn0yOaQjmTUy03NtqdhAYCQEiorlz0WLmhvdi+3F v5Xs+ZKdSb8Ht0XyzpVy/TTA1sFU/O5kLyHOWWhR5TnNxsbHOB+7ni+Eu4A2g2sdfVJY YpTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K+kEdBBD0Ebr6BEmS0pAKW0H1FSaQjZP3F74KVSYwoI=; b=MTs5o1mssTGJeQIU9hwSCpAAch2im7Ej9Mxd88qKVX/OAaE8EjWHhu0jOss6+ozNde O4O4WTAVQfeQBGnGxc/LFfP4glcOstMDDJWiAIRPsIJQkoqGciej4fEXKM4oU4DiMJnK enZ3h8rYS1gqbYS29xpyEVCFuATBaKKmFGTeZp9KGdqYVT24kFnJhAqF0iF5Awo1+Gdm IzKTst3GqLDMz4+UUela4tdtj9pZ/F72xXWu3lEAyucwwxMVUzf2+lW7rXVVg20uKVN4 HeXEmMve/OIWMGiqDSkLEKP4bC+gPlc0oyAR8/PB6mCx7EWconEVwW3ZX/Nqe2Z7jG/N jUFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ucAjiJxH; 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 x3si3877934pgf.453.2018.12.14.04.45.00; Fri, 14 Dec 2018 04:45:14 -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; dkim=pass header.i=@kernel.org header.s=default header.b=ucAjiJxH; 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 S1729804AbeLNMBj (ORCPT + 99 others); Fri, 14 Dec 2018 07:01:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:44128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729792AbeLNMBh (ORCPT ); Fri, 14 Dec 2018 07:01:37 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 159DE2133F; Fri, 14 Dec 2018 12:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544788896; bh=JrdWMq+DlAgt358f4V+N9SlrMJJKf1gEQpqgDuyfB7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ucAjiJxHG/9FVNkBuyWjqrm68hqTuLzVChPUfy4OjUnBBUwDG2JU/w7OlqVl70xAF QdRmfr1G3YjIrkUIl5w9sKO7ojrFxlUhPE/lTCQFCYmVofiSix6z+LbDJgZ32sYDaq Qwq3DKjcGTYYYkTsPaFW8MJPvSQgC3DL18/57ut0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Tinoco , Yuchung Cheng , Eric Dumazet , Neal Cardwell , "David S. Miller" Subject: [PATCH 4.19 015/142] tcp: fix NULL ref in tail loss probe Date: Fri, 14 Dec 2018 12:58:20 +0100 Message-Id: <20181214115747.658743162@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181214115747.053633987@linuxfoundation.org> References: <20181214115747.053633987@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yuchung Cheng [ Upstream commit b2b7af861122a0c0f6260155c29a1b2e594cd5b5 ] TCP loss probe timer may fire when the retranmission queue is empty but has a non-zero tp->packets_out counter. tcp_send_loss_probe will call tcp_rearm_rto which triggers NULL pointer reference by fetching the retranmission queue head in its sub-routines. Add a more detailed warning to help catch the root cause of the inflight accounting inconsistency. Reported-by: Rafael Tinoco Signed-off-by: Yuchung Cheng Signed-off-by: Eric Dumazet Signed-off-by: Neal Cardwell Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_output.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -2479,15 +2479,18 @@ void tcp_send_loss_probe(struct sock *sk goto rearm_timer; } skb = skb_rb_last(&sk->tcp_rtx_queue); + if (unlikely(!skb)) { + WARN_ONCE(tp->packets_out, + "invalid inflight: %u state %u cwnd %u mss %d\n", + tp->packets_out, sk->sk_state, tp->snd_cwnd, mss); + inet_csk(sk)->icsk_pending = 0; + return; + } /* At most one outstanding TLP retransmission. */ if (tp->tlp_high_seq) goto rearm_timer; - /* Retransmit last segment. */ - if (WARN_ON(!skb)) - goto rearm_timer; - if (skb_still_in_host_queue(sk, skb)) goto rearm_timer;