Received: by 10.223.185.111 with SMTP id b44csp910079wrg; Fri, 9 Mar 2018 16:37:20 -0800 (PST) X-Google-Smtp-Source: AG47ELsMycQ0jBe82VM2l/ctWcdz0nA3N3ar8xybbgqc5xiQ5HCx07wbUwmQZDsKUa5Z2akjLnaN X-Received: by 2002:a17:902:8e86:: with SMTP id bg6-v6mr346877plb.113.1520642239906; Fri, 09 Mar 2018 16:37:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520642239; cv=none; d=google.com; s=arc-20160816; b=U45SW4oU6vlmS/HASdr11mYjKDzS8tcRwwrFFUhgC1VnZlOlW4vlMxcknPBEyQhBBy YIZZJeVqQccdeTVfgCefv1Fj8Qvgv/sFXn6pI8ylKtTmDclS0amyfNXwZKaUewbpF6Od GJpcwMf0/zyyJ0+PtF0rhjKwgzgAnnLqIWpnX5kG0/E9ThXg4MWKdtG+crQBP0fR/QLy aZTkvE0+4hpFKK2bV+VwftKCJQVgh8FSl0kO3I2o2O6iyYAQPYwGQK+8YfkwnnZs/Lcb btUzecqiUjaZ4TLQ9JM+ba++fQWHvXKGWWqllWkzlE42Lh11tznRlqA7BVP0vizqGi52 iBdw== 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=WXqHqCOWTSQ5rQrZJqb6HOqguu0NGEgY3EWaOL5AMQw=; b=ac5IhNhgcP42949dWWwFbVO8mvrcK3vn8bd9UonPcSQ/+m1M3n9BOcRhKahJ2RQikt fBpsY39QiXSpkCkn+Ceslm4jStLbdJuSpQssKXy2UglP1hmqAP7fRT75PJfzrh4WRyLg /T0M1kIwY+TPGYzm7PQ0C2ejU1YmMmDBxn8Db2WJbFTRczLxPgBu0BGLHsSOCcrwqmFs eKtykiVzdSf+V61XaT+Yadx9ohKEQGFKd4AJIV+foaBrttO+M7YrL1F4EoeFlwgAldJW byZlfSoYSBXkr28KK0AZhZIkNsglHrupKpyz1QUXY7KD1deNJtp0Y118uZHVT+u0O5AC 8L9Q== 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 k8si1521006pgc.472.2018.03.09.16.37.05; Fri, 09 Mar 2018 16:37:19 -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 S933811AbeCJAWC (ORCPT + 99 others); Fri, 9 Mar 2018 19:22:02 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39812 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933511AbeCJAV6 (ORCPT ); Fri, 9 Mar 2018 19:21:58 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 09103FE0; Sat, 10 Mar 2018 00:21:57 +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.9 38/65] net: ipv4: dont allow setting net.ipv4.route.min_pmtu below 68 Date: Fri, 9 Mar 2018 16:18:38 -0800 Message-Id: <20180310001828.061558481@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180310001824.927996722@linuxfoundation.org> References: <20180310001824.927996722@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.9-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. */ @@ -2772,7 +2775,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",