Received: by 10.223.185.111 with SMTP id b44csp916241wrg; Fri, 9 Mar 2018 16:47:33 -0800 (PST) X-Google-Smtp-Source: AG47ELvmetn3INUh+qWaVzwr555Iibm6P3zTPpdre7UhIPx4r3zIz6dLAX0VgVgN2zwsLJlNISgV X-Received: by 2002:a17:902:a60d:: with SMTP id u13-v6mr360534plq.165.1520642853091; Fri, 09 Mar 2018 16:47:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520642853; cv=none; d=google.com; s=arc-20160816; b=CdkTRPpMQlY2NAzkiadoe/x+JlQyqoGks/KRqqatVMK7UJgKXcrYYaF6MzY6nFaFwO 1HHZtl8h72JGIlNBB5HYbuTGPk2rvkWWnZMuTGZiSnnbn32qY0A76ebk5XA7/Sg8KUW0 5lIQ+iKdXUQdDlvRalFavz0RgRygRxOV2pE92cxxQluCTeTpCErAtXZnx7G4+Zi99U2V yt5Unw2fkg+HpSpgyCRAg2j+RxqRYt8T2NMOO3GHPNu/Jrbjd0E/z12ar8bWcvk+Erkl Wy+Tm5V8yHedZ/xyxGc/gLCYxxH1nxqG+PwbuQmyXLJf0nEbibrbOJGVtTboZY6Ne3Hg 51tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=QmPTdMHDIJlHcTfcamxFDZAzcwP6ElA2xMvR2IkxEL8=; b=QcfMJfiHcrh+upNebTy5eYLtCdzZeMtbZAP1WkqsiOrDuGexwumlgdM1vDkP1W3oh8 DrK01Mh4lePNa2Xnt88qcnHyQiKmuEIeMugozxFx1EqCx+8LMUeypFFHN/j7cY5ZuQVM KhblIcCYaz0T5h4tIX6+wDxXy1kb1lIW5QHdwEK5ihHo/8OuOgqURh1+H8BrfzyL43Mc t1ucx+CORX/o7bCmW8nBLpmf2YC75TRMN9liV5JlUBkeE2O6kgGFzLJG0t440hIQxkkb /YGpitKylCMp/sDhI0DAfCkqE/8UgtNDabf8KJ+z9kZptMV8JKgcwBFPLMm43Ng1R6rT GLLg== ARC-Authentication-Results: i=1; mx.google.com; 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 z96-v6si1774804plh.35.2018.03.09.16.47.19; Fri, 09 Mar 2018 16:47:33 -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; 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 S933451AbeCJAqc (ORCPT + 99 others); Fri, 9 Mar 2018 19:46:32 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39018 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933237AbeCJAUK (ORCPT ); Fri, 9 Mar 2018 19:20:10 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4ED20F4D; Sat, 10 Mar 2018 00:20:10 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianlin Shi , Sabrina Dubroca , Stefano Brivio , "David S. Miller" Subject: [PATCH 4.4 23/36] net: ipv4: dont allow setting net.ipv4.route.min_pmtu below 68 Date: Fri, 9 Mar 2018 16:18:39 -0800 Message-Id: <20180310001808.625785589@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180310001807.213987241@linuxfoundation.org> References: <20180310001807.213987241@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sabrina Dubroca [ Upstream commit c7272c2f1229125f74f22dcdd59de9bbd804f1c8 ] According to RFC 1191 sections 3 and 4, ICMP frag-needed messages indicating an MTU below 68 should be rejected: A host MUST never reduce its estimate of the Path MTU below 68 octets. and (talking about ICMP frag-needed's Next-Hop MTU field): This field will never contain a value less than 68, since every router "must be able to forward a datagram of 68 octets without fragmentation". Furthermore, by letting net.ipv4.route.min_pmtu be set to negative values, we can end up with a very large PMTU when (-1) is cast into u32. Let's also make ip_rt_min_pmtu a u32, since it's only ever compared to unsigned ints. Reported-by: Jianlin Shi Signed-off-by: Sabrina Dubroca Reviewed-by: Stefano Brivio Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/route.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -126,10 +126,13 @@ static int ip_rt_redirect_silence __read static int ip_rt_error_cost __read_mostly = HZ; static int ip_rt_error_burst __read_mostly = 5 * HZ; static int ip_rt_mtu_expires __read_mostly = 10 * 60 * HZ; -static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; +static u32 ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; static int ip_rt_min_advmss __read_mostly = 256; static int ip_rt_gc_timeout __read_mostly = RT_GC_TIMEOUT; + +static int ip_min_valid_pmtu __read_mostly = IPV4_MIN_MTU; + /* * Interface to generic destination cache. */ @@ -2765,7 +2768,8 @@ static struct ctl_table ipv4_route_table .data = &ip_rt_min_pmtu, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, + .extra1 = &ip_min_valid_pmtu, }, { .procname = "min_adv_mss",