net: gain ipv4 mtu when mtu is not locked
authorMiaohe Lin <linmiaohe@huawei.com>
Tue, 25 Aug 2020 03:20:28 +0000 (23:20 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Aug 2020 13:04:39 +0000 (06:04 -0700)
When mtu is locked, we should not obtain ipv4 mtu as we return immediately
in this case and leave acquired ipv4 mtu unused.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/route.c

index 8ca6bcab7b03d9204fc0de3adca2cdd0c8e0672d..18c8baf32de563ea21174f145ca21e4d06d35286 100644 (file)
@@ -1013,13 +1013,14 @@ out:    kfree_skb(skb);
 static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
 {
        struct dst_entry *dst = &rt->dst;
-       u32 old_mtu = ipv4_mtu(dst);
        struct fib_result res;
        bool lock = false;
+       u32 old_mtu;
 
        if (ip_mtu_locked(dst))
                return;
 
+       old_mtu = ipv4_mtu(dst);
        if (old_mtu < mtu)
                return;