Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5455100imm; Tue, 16 Oct 2018 10:28:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV633GstbABOzK0Q0oQiEIMbei0g5LHJJSP+bP7Fdc2rfS9Xc1TWZN7IjBTLlc2QC6jGfPuBo X-Received: by 2002:a63:7156:: with SMTP id b22-v6mr20820794pgn.342.1539710919939; Tue, 16 Oct 2018 10:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539710919; cv=none; d=google.com; s=arc-20160816; b=W3wLqAs0kxnHH1pZLeey43b9DU4mNwHLqXOMFcSLS19a5tiJffbw1ldX6AQLAWj+YF jwKkJdMq1A0LLRxdC9vvcOoSSu2Hj8AmTxtlYgKoBXCYPDAjxeWxBvevzDqTeSr0NTGU WQWPGeRkmB0WBaule1bmUTjlwYcNIjdRoOmXuGOIH2UtZro/B3zKRnOJy94KT2MelJzD W7gMct4c5F8VmtJQ7Z9lrIuidocT/D9FMZNa96T8HwFxxOoZ5Aj1FpCHiGU0ExbqRBo0 wDrUuFMsg44tfshHlvSsnpCDTYwlgOYt06FXfAwxHgL+52e5C+l9B/5QOtf0xmBOJbHJ HHDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mbS6lTlXtDWzcBNM70D3J+bN2x/koqhgIuO0EhBt2xs=; b=aRnCWuqzNhvUZmIaSCFR/JdxZWhUkU0Usr13ylsy1UopSNQjXS7cgAJ4ZCi3xWCrsd 2g2XR9QNEeNvD7upNgv8VrOJwfE4/pInRBgzIJh6XE6k2d9QoiQ7kuG4YsIATyfw8YG8 RM5wJAMhqg7k3VHzL3VQA1dfKmtSHcQvBPlCIIzQLThCFuPvHE7Ul5zUsyfMoGE8/Fhi lTRL1F5fsGgszcezmqaS+isqZxsiQ1k+zkzPNFrAD78ct84xx2W3w+qDXbcAnJBx+xs9 4Eb14CqKlydBHSoaZi4/GFWrQiY3aRFrWsrdr+kratLGK+z0CCKso3n6IaDiGQzXQcd3 SPww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="ENRl0G/u"; 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 v20-v6si12455598pgk.586.2018.10.16.10.28.24; Tue, 16 Oct 2018 10:28:39 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b="ENRl0G/u"; 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 S1731933AbeJQBQo (ORCPT + 99 others); Tue, 16 Oct 2018 21:16:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:35432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730396AbeJQBQn (ORCPT ); Tue, 16 Oct 2018 21:16:43 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (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 748A3204EC; Tue, 16 Oct 2018 17:25:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710717; bh=gCW09eknm3EuafeZOrMVeCsOGjCszkDdkJBNOMjY8f8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENRl0G/uXzmCJvtaine1AhKx4hmckG0Y4JSBVLJVKBpul5dgU3Kt7I5oO3gyL9LwI GuDpIVJtwyosU+3uveI/hXCcQaXmN+a13s120Mokh7a0CzHS8ImN0mgkinbx3Rglmx c7ptG90qWl8nJO522YdUrA2DPcwviklCCXevt3sc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Oskolkov , Eric Dumazet , Florian Westphal , "David S. Miller" Subject: [PATCH 4.9 64/71] ipv6: defrag: drop non-last frags smaller than min mtu Date: Tue, 16 Oct 2018 19:10:01 +0200 Message-Id: <20181016170542.593416686@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170539.315587743@linuxfoundation.org> References: <20181016170539.315587743@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Westphal don't bother with pathological cases, they only waste cycles. IPv6 requires a minimum MTU of 1280 so we should never see fragments smaller than this (except last frag). v3: don't use awkward "-offset + len" v2: drop IPv4 part, which added same check w. IPV4_MIN_MTU (68). There were concerns that there could be even smaller frags generated by intermediate nodes, e.g. on radio networks. Cc: Peter Oskolkov Cc: Eric Dumazet Signed-off-by: Florian Westphal Signed-off-by: David S. Miller (cherry picked from commit 0ed4229b08c13c84a3c301a08defdc9e7f4467e6) Signed-off-by: Greg Kroah-Hartman --- net/ipv6/netfilter/nf_conntrack_reasm.c | 4 ++++ net/ipv6/reassembly.c | 4 ++++ 2 files changed, 8 insertions(+) --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c @@ -564,6 +564,10 @@ int nf_ct_frag6_gather(struct net *net, hdr = ipv6_hdr(skb); fhdr = (struct frag_hdr *)skb_transport_header(skb); + if (skb->len - skb_network_offset(skb) < IPV6_MIN_MTU && + fhdr->frag_off & htons(IP6_MF)) + return -EINVAL; + skb_orphan(skb); fq = fq_find(net, fhdr->identification, user, hdr, skb->dev ? skb->dev->ifindex : 0); --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c @@ -516,6 +516,10 @@ static int ipv6_frag_rcv(struct sk_buff return 1; } + if (skb->len - skb_network_offset(skb) < IPV6_MIN_MTU && + fhdr->frag_off & htons(IP6_MF)) + goto fail_hdr; + iif = skb->dev ? skb->dev->ifindex : 0; fq = fq_find(net, fhdr->identification, hdr, iif); if (fq) {