From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:46412 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754287AbdHYAp1 (ORCPT ); Thu, 24 Aug 2017 20:45:27 -0400 Subject: Patch "ipv4: better IP_MAX_MTU enforcement" has been added to the 4.12-stable tree To: edumazet@google.com, davem@davemloft.net, gregkh@linuxfoundation.org Cc: , From: Date: Thu, 24 Aug 2017 17:44:38 -0700 Message-ID: <1503621878158241@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled ipv4: better IP_MAX_MTU enforcement to the 4.12-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ipv4-better-ip_max_mtu-enforcement.patch and it can be found in the queue-4.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From foo@baz Thu Aug 24 17:43:45 PDT 2017 From: Eric Dumazet Date: Wed, 16 Aug 2017 11:09:12 -0700 Subject: ipv4: better IP_MAX_MTU enforcement From: Eric Dumazet [ Upstream commit c780a049f9bf442314335372c9abc4548bfe3e44 ] While working on yet another syzkaller report, I found that our IP_MAX_MTU enforcements were not properly done. gcc seems to reload dev->mtu for min(dev->mtu, IP_MAX_MTU), and final result can be bigger than IP_MAX_MTU :/ This is a problem because device mtu can be changed on other cpus or threads. While this patch does not fix the issue I am working on, it is probably worth addressing it. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/net/ip.h | 4 ++-- net/ipv4/route.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) --- a/include/net/ip.h +++ b/include/net/ip.h @@ -352,7 +352,7 @@ static inline unsigned int ip_dst_mtu_ma !forwarding) return dst_mtu(dst); - return min(dst->dev->mtu, IP_MAX_MTU); + return min(READ_ONCE(dst->dev->mtu), IP_MAX_MTU); } static inline unsigned int ip_skb_dst_mtu(struct sock *sk, @@ -364,7 +364,7 @@ static inline unsigned int ip_skb_dst_mt return ip_dst_mtu_maybe_forward(skb_dst(skb), forwarding); } - return min(skb_dst(skb)->dev->mtu, IP_MAX_MTU); + return min(READ_ONCE(skb_dst(skb)->dev->mtu), IP_MAX_MTU); } u32 ip_idents_reserve(u32 hash, int segs); --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1268,7 +1268,7 @@ static unsigned int ipv4_mtu(const struc if (mtu) return mtu; - mtu = dst->dev->mtu; + mtu = READ_ONCE(dst->dev->mtu); if (unlikely(dst_metric_locked(dst, RTAX_MTU))) { if (rt->rt_uses_gateway && mtu > 576) Patches currently in stable-queue which might be from edumazet@google.com are queue-4.12/ipv4-fix-null-dereference-in-free_fib_info_rcu.patch queue-4.12/tcp-when-rearming-rto-if-rto-time-is-in-past-then-fire-rto-asap.patch queue-4.12/ipv4-better-ip_max_mtu-enforcement.patch queue-4.12/dccp-defer-ccid_hc_tx_delete-at-dismantle-time.patch queue-4.12/tun-handle-register_netdevice-failures-properly.patch queue-4.12/tipc-fix-use-after-free.patch queue-4.12/af_key-do-not-use-gfp_kernel-in-atomic-contexts.patch queue-4.12/ipv6-repair-fib6-tree-in-failure-case.patch queue-4.12/dccp-purge-write-queue-in-dccp_destroy_sock.patch queue-4.12/ipv6-reset-fn-rr_ptr-when-replacing-route.patch queue-4.12/ptr_ring-use-kmalloc_array.patch queue-4.12/net_sched-sfq-update-hierarchical-backlog-when-drop-packet.patch