|
@@ -1018,7 +1018,7 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt,
|
|
/* Create subtree root node */
|
|
/* Create subtree root node */
|
|
sfn = node_alloc();
|
|
sfn = node_alloc();
|
|
if (!sfn)
|
|
if (!sfn)
|
|
- goto st_failure;
|
|
|
|
|
|
+ goto failure;
|
|
|
|
|
|
sfn->leaf = info->nl_net->ipv6.ip6_null_entry;
|
|
sfn->leaf = info->nl_net->ipv6.ip6_null_entry;
|
|
atomic_inc(&info->nl_net->ipv6.ip6_null_entry->rt6i_ref);
|
|
atomic_inc(&info->nl_net->ipv6.ip6_null_entry->rt6i_ref);
|
|
@@ -1035,12 +1035,12 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt,
|
|
|
|
|
|
if (IS_ERR(sn)) {
|
|
if (IS_ERR(sn)) {
|
|
/* If it is failed, discard just allocated
|
|
/* If it is failed, discard just allocated
|
|
- root, and then (in st_failure) stale node
|
|
|
|
|
|
+ root, and then (in failure) stale node
|
|
in main tree.
|
|
in main tree.
|
|
*/
|
|
*/
|
|
node_free(sfn);
|
|
node_free(sfn);
|
|
err = PTR_ERR(sn);
|
|
err = PTR_ERR(sn);
|
|
- goto st_failure;
|
|
|
|
|
|
+ goto failure;
|
|
}
|
|
}
|
|
|
|
|
|
/* Now link new subtree to main tree */
|
|
/* Now link new subtree to main tree */
|
|
@@ -1055,7 +1055,7 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt,
|
|
|
|
|
|
if (IS_ERR(sn)) {
|
|
if (IS_ERR(sn)) {
|
|
err = PTR_ERR(sn);
|
|
err = PTR_ERR(sn);
|
|
- goto st_failure;
|
|
|
|
|
|
+ goto failure;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1096,18 +1096,17 @@ out:
|
|
atomic_inc(&pn->leaf->rt6i_ref);
|
|
atomic_inc(&pn->leaf->rt6i_ref);
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
- /* Always release dst as dst->__refcnt is guaranteed
|
|
|
|
- * to be taken before entering this function
|
|
|
|
- */
|
|
|
|
- dst_release_immediate(&rt->dst);
|
|
|
|
|
|
+ goto failure;
|
|
}
|
|
}
|
|
return err;
|
|
return err;
|
|
|
|
|
|
-#ifdef CONFIG_IPV6_SUBTREES
|
|
|
|
- /* Subtree creation failed, probably main tree node
|
|
|
|
- is orphan. If it is, shoot it.
|
|
|
|
|
|
+failure:
|
|
|
|
+ /* fn->leaf could be NULL if fn is an intermediate node and we
|
|
|
|
+ * failed to add the new route to it in both subtree creation
|
|
|
|
+ * failure and fib6_add_rt2node() failure case.
|
|
|
|
+ * In both cases, fib6_repair_tree() should be called to fix
|
|
|
|
+ * fn->leaf.
|
|
*/
|
|
*/
|
|
-st_failure:
|
|
|
|
if (fn && !(fn->fn_flags & (RTN_RTINFO|RTN_ROOT)))
|
|
if (fn && !(fn->fn_flags & (RTN_RTINFO|RTN_ROOT)))
|
|
fib6_repair_tree(info->nl_net, fn);
|
|
fib6_repair_tree(info->nl_net, fn);
|
|
/* Always release dst as dst->__refcnt is guaranteed
|
|
/* Always release dst as dst->__refcnt is guaranteed
|
|
@@ -1115,7 +1114,6 @@ st_failure:
|
|
*/
|
|
*/
|
|
dst_release_immediate(&rt->dst);
|
|
dst_release_immediate(&rt->dst);
|
|
return err;
|
|
return err;
|
|
-#endif
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|