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,URIBL_BLOCKED,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 840E4C43381 for ; Thu, 21 Feb 2019 14:41:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4FC9A2080D for ; Thu, 21 Feb 2019 14:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550760081; bh=IwCxBwDFQoqijV21jD/mF24TV8Ixn9c+Zal2yH7bIFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=iAwucTBcs7ekz9aE/L6pxAGoM55KPzlGZzskfeRGFO/P2kWEFiG6DBsHuhi88l511 zRuntyIdKZ+iLkCsmT3xSIuXYjGs7qGGd9V0RvCKscgLdYxJc7F6hxHXM6G3NRcEQ1 uSW0rzGrC8GZkaHRejwhoy3XbBcxn96n/AaE9ELE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728816AbfBUOlU (ORCPT ); Thu, 21 Feb 2019 09:41:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:36224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729276AbfBUOlQ (ORCPT ); Thu, 21 Feb 2019 09:41:16 -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 BD13B2080D; Thu, 21 Feb 2019 14:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550760076; bh=IwCxBwDFQoqijV21jD/mF24TV8Ixn9c+Zal2yH7bIFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gH7nDVuB/MebS9U7QWFOkqK4ni81PbyAEX9gBwx4J8fE/Vn7z2CPqfdjg2uVQIBu3 m9S5xisCfv3qDh8uh9PTJXMEAn2mYjUiD7Zk1jpKUpSuFLkjW4HQUT5d1snv5AARZ0 G7h20TuAB/fYSf8oeqQr+FEfdGCQ8Gut1s487tlw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , soukjin bae , Neal Cardwell , Soheil Hassas Yeganeh , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 19/30] tcp: tcp_v4_err() should be more careful Date: Thu, 21 Feb 2019 15:36:01 +0100 Message-Id: <20190221125251.607257836@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221125250.543158526@linuxfoundation.org> References: <20190221125250.543158526@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. ------------------ [ Upstream commit 2c4cc9712364c051b1de2d175d5fbea6be948ebf ] ICMP handlers are not very often stressed, we should make them more resilient to bugs that might surface in the future. If there is no packet in retransmit queue, we should avoid a NULL deref. Signed-off-by: Eric Dumazet Reported-by: soukjin bae Acked-by: Neal Cardwell Acked-by: Soheil Hassas Yeganeh Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_ipv4.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -535,14 +535,15 @@ void tcp_v4_err(struct sk_buff *icmp_skb if (sock_owned_by_user(sk)) break; + skb = tcp_rtx_queue_head(sk); + if (WARN_ON_ONCE(!skb)) + break; + icsk->icsk_backoff--; icsk->icsk_rto = tp->srtt_us ? __tcp_set_rto(tp) : TCP_TIMEOUT_INIT; icsk->icsk_rto = inet_csk_rto_backoff(icsk, TCP_RTO_MAX); - skb = tcp_rtx_queue_head(sk); - BUG_ON(!skb); - tcp_mstamp_refresh(tp); delta_us = (u32)(tp->tcp_mstamp - skb->skb_mstamp); remaining = icsk->icsk_rto -