diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 42e84e08a1becd4b64a65a74758bf4e13783a8ae..d0787284cb07ed3a2cc03e738b2509666c2d7f1a 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c @@ -225,9 +225,11 @@ int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl, err = ops->action(rule, fl, flags, arg); if (err != -EAGAIN) { - fib_rule_get(rule); - arg->rule = rule; - goto out; + if (likely(atomic_inc_not_zero(&rule->refcnt))) { + arg->rule = rule; + goto out; + } + break; } }