From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x225YVhO1yA6U5FHw1F+TYCly9gGw0kwRHboNOv0kpIndmN368v1zwFadfaxih3DqyGLS0491 ARC-Seal: i=1; a=rsa-sha256; t=1517256878; cv=none; d=google.com; s=arc-20160816; b=wZdrsPxSXFKKyW6QdMm51BSLHdZ8peJOW9bBjSDnJDgQ7YXR10ZPxzcoV41GGCCnje mMRuoXN8jinjS/aaOCCgYGi7c5UVu/xmjD3n92rt2P+ZDPAsft8GL3li35VdVIEZUAOP Yy06lATRj5y2SuYgrDSZKECJPOayr4692Vv9Wzf4E4p0iKE1st6uwx54EwRoSFdSzNhE vcEo2ylll/NuFYvUrgLf2P6LmPRo9fibeC9kfOQnAddRXl2cf+ne7viHaVeUd34g4ozg x2NGJNUkb1wLHWXgSItR8vY51/RhJqyl+kiV4woaTO+li+fTyByo7FUpCz1RzWwqfXnl 7cBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=+PP4iQjvQpBOzQLilSwJhYQY8q4yBNhPSn2YshN5Jjk=; b=EXmO13dgxkIMSdty1ZAEYfkkodjRRl5gykOeqVmkvEGW9tqCYGxVYyFPX3QvJxHUz+ zyxuy8snaCx13RKeHT4U4ZIdUzQ8V+oHKlRbTd7DWYQQtoyX9+wiR7pDTE9p8UVzirJq +MO904S2ss77YvO2dFxRiK4+b+i8qG7z7j1ZQCgbhL/cXZR23xdbPeZsUCmykYX7jOxo J39bS4wCGE2JUpFAMd7FCJyBi6rvQ6Njd40fuNPk+jYt1oXRghoPZEBtYx5aJ60Loi67 ZgVui+w2CZSX0sq+LnPAAJmdUx4ncX5H6ZCIx1KZ82MWtfxuil9FPXnFpB/aGROLhoff HlXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kodanev , "David S. Miller" Subject: [PATCH 4.9 51/66] ip6_gre: init dev->mtu and dev->hard_header_len correctly Date: Mon, 29 Jan 2018 13:57:15 +0100 Message-Id: <20180129123842.575176117@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123839.842860149@linuxfoundation.org> References: <20180129123839.842860149@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590958490263150740?= X-GMAIL-MSGID: =?utf-8?q?1590959148434307011?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexey Kodanev [ Upstream commit 128bb975dc3c25d00de04e503e2fe0a780d04459 ] Commit b05229f44228 ("gre6: Cleanup GREv6 transmit path, call common GRE functions") moved dev->mtu initialization from ip6gre_tunnel_setup() to ip6gre_tunnel_init(), as a result, the previously set values, before ndo_init(), are reset in the following cases: * rtnl_create_link() can update dev->mtu from IFLA_MTU parameter. * ip6gre_tnl_link_config() is invoked before ndo_init() in netlink and ioctl setup, so ndo_init() can reset MTU adjustments with the lower device MTU as well, dev->mtu and dev->hard_header_len. Not applicable for ip6gretap because it has one more call to ip6gre_tnl_link_config(tunnel, 1) in ip6gre_tap_init(). Fix the first case by updating dev->mtu with 'tb[IFLA_MTU]' parameter if a user sets it manually on a device creation, and fix the second one by moving ip6gre_tnl_link_config() call after register_netdevice(). Fixes: b05229f44228 ("gre6: Cleanup GREv6 transmit path, call common GRE functions") Fixes: db2ec95d1ba4 ("ip6_gre: Fix MTU setting") Signed-off-by: Alexey Kodanev Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6_gre.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -337,11 +337,12 @@ static struct ip6_tnl *ip6gre_tunnel_loc nt->dev = dev; nt->net = dev_net(dev); - ip6gre_tnl_link_config(nt, 1); if (register_netdevice(dev) < 0) goto failed_free; + ip6gre_tnl_link_config(nt, 1); + /* Can use a lockless transmit, unless we generate output sequences */ if (!(nt->parms.o_flags & TUNNEL_SEQ)) dev->features |= NETIF_F_LLTX; @@ -1263,7 +1264,6 @@ static void ip6gre_netlink_parms(struct static int ip6gre_tap_init(struct net_device *dev) { - struct ip6_tnl *tunnel; int ret; ret = ip6gre_tunnel_init_common(dev); @@ -1272,10 +1272,6 @@ static int ip6gre_tap_init(struct net_de dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; - tunnel = netdev_priv(dev); - - ip6gre_tnl_link_config(tunnel, 1); - return 0; } @@ -1370,7 +1366,6 @@ static int ip6gre_newlink(struct net *sr nt->dev = dev; nt->net = dev_net(dev); - ip6gre_tnl_link_config(nt, !tb[IFLA_MTU]); dev->features |= GRE6_FEATURES; dev->hw_features |= GRE6_FEATURES; @@ -1396,6 +1391,11 @@ static int ip6gre_newlink(struct net *sr if (err) goto out; + ip6gre_tnl_link_config(nt, !tb[IFLA_MTU]); + + if (tb[IFLA_MTU]) + ip6_tnl_change_mtu(dev, nla_get_u32(tb[IFLA_MTU])); + dev_hold(dev); ip6gre_tunnel_link(ign, nt);