ipv6: delay fib6_sernum increase in fib6_add
authorzhang kai <zhangkaiheb@126.com>
Thu, 9 Sep 2021 08:39:18 +0000 (16:39 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Sep 2021 08:11:06 +0000 (10:11 +0200)
[ Upstream commit e87b5052271e39d62337ade531992b7e5d8c2cfa ]

only increase fib6_sernum in net namespace after add fib6_info
successfully.

Signed-off-by: zhang kai <zhangkaiheb@126.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv6/ip6_fib.c

index 1fb79dbde0cb34ea2e69ab12d25b59d4a2d66c46..e43f1fbac28b67ed3fe186adbde26d2653167864 100644 (file)
@@ -1376,7 +1376,6 @@ int fib6_add(struct fib6_node *root, struct fib6_info *rt,
        int err = -ENOMEM;
        int allow_create = 1;
        int replace_required = 0;
-       int sernum = fib6_new_sernum(info->nl_net);
 
        if (info->nlh) {
                if (!(info->nlh->nlmsg_flags & NLM_F_CREATE))
@@ -1476,7 +1475,7 @@ int fib6_add(struct fib6_node *root, struct fib6_info *rt,
        if (!err) {
                if (rt->nh)
                        list_add(&rt->nh_list, &rt->nh->f6i_list);
-               __fib6_update_sernum_upto_root(rt, sernum);
+               __fib6_update_sernum_upto_root(rt, fib6_new_sernum(info->nl_net));
                fib6_start_gc(info->nl_net, rt);
        }