diff options
author | David Ahern <dsa@cumulusnetworks.com> | 2018-03-27 18:21:56 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-03-29 14:10:30 -0400 |
commit | 9776d32537d2bbc251fd1de651e2bb2439474bde (patch) | |
tree | ceee723abc28591a3a0062ee126f663b922e4ebe /net/core | |
parent | c30d9356e9e8ed0735c1215e187b03d3ae8b4966 (diff) | |
download | op-kernel-dev-9776d32537d2bbc251fd1de651e2bb2439474bde.zip op-kernel-dev-9776d32537d2bbc251fd1de651e2bb2439474bde.tar.gz |
net: Move call_fib_rule_notifiers up in fib_nl_newrule
Move call_fib_rule_notifiers up in fib_nl_newrule to the point right
before the rule is inserted into the list. At this point there are no
more failure paths within the core rule code, so if the notifier
does not fail then the rule will be inserted into the list.
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/fib_rules.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 9d87ce8..33958f8 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c @@ -631,6 +631,11 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, if (err < 0) goto errout_free; + err = call_fib_rule_notifiers(net, FIB_EVENT_RULE_ADD, rule, ops, + extack); + if (err < 0) + goto errout_free; + list_for_each_entry(r, &ops->rules_list, list) { if (r->pref > rule->pref) break; @@ -667,7 +672,6 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, if (rule->tun_id) ip_tunnel_need_metadata(); - call_fib_rule_notifiers(net, FIB_EVENT_RULE_ADD, rule, ops, extack); notify_rule_change(RTM_NEWRULE, rule, ops, nlh, NETLINK_CB(skb).portid); flush_route_cache(ops); rules_ops_put(ops); |