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=unavailable 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 231C9C43381 for ; Thu, 21 Feb 2019 14:45:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D85CF20700 for ; Thu, 21 Feb 2019 14:45:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550760335; bh=KorX5UeMHPd2VefLGE1COcXJROC/faoAEs/FrXekl3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gTJNJ8bGmiPD2FNF22Tbfeg8W5loaMiCNdJPisn+q171qaDd+rt0jekPpDbYSPV/W Z7yvKMKIIUwHOe0y1SeadIN85/6Fd1k4uAsoXzRSVoxSMoc14b+cq0noVbuW4/9Siv J2U9VRYq5pfMiNDmXumzqaJ1F3hYv7Gy7H1O1zoE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729596AbfBUOmz (ORCPT ); Thu, 21 Feb 2019 09:42:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:38492 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728896AbfBUOmv (ORCPT ); Thu, 21 Feb 2019 09:42:51 -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 592C02080D; Thu, 21 Feb 2019 14:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550760170; bh=KorX5UeMHPd2VefLGE1COcXJROC/faoAEs/FrXekl3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KuzsUiwwL9/zZjI8SNGc+pkoAla92M80QCtw5pntNDnxihZq5WwVKvs1RyE4TgBqR KkB3QZRC9M66z2OYDWA9uhdOmV9/87yZ1roWTLhhqSZ1mHdhpfcQUDQfbk9IpxdyzB gkHSnI+7VTvGhoZ7ONYXCCBi6exC4uWc0sXC35g8= 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.20 18/32] tcp: tcp_v4_err() should be more careful Date: Thu, 21 Feb 2019 15:36:06 +0100 Message-Id: <20190221125251.958223874@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221125250.855065214@linuxfoundation.org> References: <20190221125250.855065214@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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.20-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 - tcp_skb_timestamp_us(skb)); remaining = icsk->icsk_rto -