From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8068C6786C for ; Fri, 14 Dec 2018 12:35:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A2C1A20892 for ; Fri, 14 Dec 2018 12:35:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544790908; bh=be9+f80dcx+0ujA/w8eYa4xb1it4+sMqUmY3hGEiA40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=LDJQHv2lqZuxf3V0hfs50UG1TqvnFWkS2tlJBg68Jb47/v294VCRjHHsZLqdHRLg3 FzWg08FWH7KOxRhUKfybRKwvEdHTpC7YIB/UNFd7ZoPiRi8GKN+N3oNIV497dd6Tr7 dZQq+FN4U9dvsPYGsrVw4eq2qKXfft9DR6QVsH3g= DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2C1A20892 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731118AbeLNMfH (ORCPT ); Fri, 14 Dec 2018 07:35:07 -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;