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=-16.6 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 B534FC43444 for ; Wed, 16 Jan 2019 23:05:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8323820675 for ; Wed, 16 Jan 2019 23:05:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="W8fCww2X" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387936AbfAPXFy (ORCPT ); Wed, 16 Jan 2019 18:05:54 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:38839 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726196AbfAPXFw (ORCPT ); Wed, 16 Jan 2019 18:05:52 -0500 Received: by mail-pf1-f195.google.com with SMTP id q1so3799366pfi.5 for ; Wed, 16 Jan 2019 15:05:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rwPQA0GrSsFJgFnZ2hJ2WvsV9TaC1QflgEaItJNj6rs=; b=W8fCww2XFJoS2iAxpEv+yd1/WChQ9JD8byLNZVvMjNXR9Cc7gNXAwL1nbCAH2S6dP8 f0DIDuuPYGzr/XG2RzOMlJ42qxMmGRasgd59LlKdCYRwyqqReKhc4/HXNGf37Iq4se6b Nhz80ehXziHFMFaV9yDyKaYgT4TNbJbePXa5IOuVk69huYIioBT2dXqcmDTa18H7tpFY BZcSp/xbXDCO/eGsN1vUgPOyd6qALhTlbxfEKK1zVY5HXRtlBgiptkew93Twt/oNFRR/ lLCF2mtuxP933U1J1uyVSI/xSm/WRDwthIy2JifU27eFL5gUZxMzErpPma486I4bb4X+ L7Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rwPQA0GrSsFJgFnZ2hJ2WvsV9TaC1QflgEaItJNj6rs=; b=fa12xFPIzkpFU496T2eh7wjfKFRe7jn0L3S0rFYpprHR4R5zOnJvlpj6471AJDKBEe CneAi4RxBshj1NnF5lLsg5vJ4zWnggA+0bN4diJ3kabnM3YbO6SPgE9dzOd7359dxUB5 NwfqBM79VTniS7QcyFwXPXJT7sCBi8kAKBsWGQzbvwc9OE+eB16Mi6s2O21wXAqmHEyQ RoPtOteWqmqNlxhqwUZMTIc6sv58HC7nupHSibdrPjW5DAgDybHm0vViSqQxY8nsFmgJ WoX2Z1FchoKQzCg8g7GavDiWDbbwZfZVU0S5qIQsjYkidKUEQcMbO06NKLl+23WAq3Dq xwDA== X-Gm-Message-State: AJcUukeVJTVcuNd5tKmjYJLoC8LlwSC030xeiOk93mcU80dQ0Cnp2Epd P+sBqvtlaKm4TtdgT77lR1YpTw== X-Google-Smtp-Source: ALg8bN7+7TPgOPayAPIn4vDYACxrm/sFLAhEg7FbswII20cRUNNLO9RPI11ASkoC9gmnysy01Okiaw== X-Received: by 2002:a62:c42:: with SMTP id u63mr12088027pfi.73.1547679951009; Wed, 16 Jan 2019 15:05:51 -0800 (PST) Received: from ycheng2.svl.corp.google.com ([2620:15c:2c4:201:d660:6c0b:8a4f:4c77]) by smtp.gmail.com with ESMTPSA id k186sm8481087pge.13.2019.01.16.15.05.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 15:05:49 -0800 (PST) From: Yuchung Cheng To: davem@davemloft.net, edumazet@google.com Cc: netdev@vger.kernel.org, ncardwell@google.com, soheil@google.com, Yuchung Cheng Subject: [PATCH net-next 1/8] tcp: exit if nothing to retransmit on RTO timeout Date: Wed, 16 Jan 2019 15:05:28 -0800 Message-Id: <20190116230535.162758-2-ycheng@google.com> X-Mailer: git-send-email 2.20.1.97.g81188d93c3-goog In-Reply-To: <20190116230535.162758-1-ycheng@google.com> References: <20190116230535.162758-1-ycheng@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Previously TCP only warns if its RTO timer fires and the retransmission queue is empty, but it'll cause null pointer reference later on. It's better to avoid such catastrophic failure and simply exit with a warning. Signed-off-by: Yuchung Cheng Signed-off-by: Eric Dumazet Reviewed-by: Neal Cardwell Reviewed-by: Soheil Hassas Yeganeh --- net/ipv4/tcp_timer.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 71a29e9c0620..e7d09e3705b8 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c @@ -443,10 +443,8 @@ void tcp_retransmit_timer(struct sock *sk) */ return; } - if (!tp->packets_out) - goto out; - - WARN_ON(tcp_rtx_queue_empty(sk)); + if (!tp->packets_out || WARN_ON_ONCE(tcp_rtx_queue_empty(sk))) + return; tp->tlp_high_seq = 0; -- 2.20.1.97.g81188d93c3-goog