Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2019232imu; Fri, 14 Dec 2018 04:36:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/XwMzDl+7DT6tCmS7KcXV5F8M2fqfuTFXTmWaNzULjgjYRlKC2IB6qvc77E/04OTeCEoy2Y X-Received: by 2002:a17:902:e290:: with SMTP id cf16mr2789604plb.81.1544790969904; Fri, 14 Dec 2018 04:36:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544790969; cv=none; d=google.com; s=arc-20160816; b=QqNhML+69ifeYrB7Nct0rWLbApGsZ+5FQHQJlwgJ1xX26QaF+qG3sh2UZUJa1rdZQ6 tfrJrM5osXmgQHA3QNsONgmAGeq9xvvhOyvWf0VHSkDUDy7urLfhkSsKNAiWtE5caQDa a1860iZcBAJ8xeZQVofGQiz/ArKf7vY9CfM5W1J2dzBxWrzUDunYTq0ioj9l9xMQF4bD EL9XsC72oYFoGF/PcOjRLVY3TMWjLI1VoJqdAPo6ufTXbJssefB2kKuoYBRqu2ZdWq8c UvItCGAm+rZ49t+WeJ/AB29nI+siF58TdKALaNXD/fJkeG6BMj9Q6YpaAbBw5UGlE/JD QaFg== 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=aGlrp7zXuxGDs26U8giG0NlM+EzPg/ev2NgaDZ/FnrA=; b=pvOifuNgxMhbd+VPkYof9lKbGbuP6tbErAW6kwWLC6A94QYWLoJu5por/VeuSJ28tj P3rCh5AVyBErtw1BKKnKFMGipIjw3C3oNeoY3ZrgulvYk+wtp0ekCpMG5cqp5GEsMqRc p15P3SKDifu3H1J3V9435yTPwbPbd+0DpMc8XcMrdDgll6Ofbc5SoCZeEwWMVviYwjtF /Uade49YGAgM3kLDn+0NRBpFY7Umfecg1M1xwlFe7AVD5M0mjMQoeb5+vjKtIZ18LsYo cOtwoKsyDtGcxRQI2PB1nSh1CXc6pPw4GlB9HP0yo9Sg0EKEHVS5yLBpPeCqZytNzfbI U/Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ANMYoUdD; 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 e7si3798124pgi.263.2018.12.14.04.35.53; Fri, 14 Dec 2018 04:36:09 -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=ANMYoUdD; 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 S1730688AbeLNMfG (ORCPT + 99 others); Fri, 14 Dec 2018 07:35:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:52960 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731148AbeLNMHi (ORCPT ); Fri, 14 Dec 2018 07:07:38 -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 721832147D; Fri, 14 Dec 2018 12:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544789257; bh=be9+f80dcx+0ujA/w8eYa4xb1it4+sMqUmY3hGEiA40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ANMYoUdDzTRjSDC9W7LGl8wYDH9RV7DYFuMPB9HRGMzLu6ALF+fs/4+1k6Y/L1fC0 HKVWTZBzsIgT3LtrMYDiVgDdMPRouTz5x4FwV4LBRgOOXeFyjam5JY1fjnSMy6devj eC91SSA3dJj9GFvk/bdxOfx3ymtcIW2tGx3t2FsE= 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.14 13/89] tcp: fix NULL ref in tail loss probe Date: Fri, 14 Dec 2018 12:59:26 +0100 Message-Id: <20181214115730.332438078@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181214115729.658859279@linuxfoundation.org> References: <20181214115729.658859279@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.14-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 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -2476,14 +2476,18 @@ void tcp_send_loss_probe(struct sock *sk skb = tcp_write_queue_tail(sk); } + 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;