提交 3661a910 编写于 作者: D Denis V. Lunev 提交者: David S. Miller

[NETNS]: Add netns refcnt debug to fib rules.

Signed-off-by: NDenis V. Lunev <den@openvz.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 48115bec
...@@ -87,6 +87,7 @@ static inline void fib_rule_get(struct fib_rule *rule) ...@@ -87,6 +87,7 @@ static inline void fib_rule_get(struct fib_rule *rule)
static inline void fib_rule_put_rcu(struct rcu_head *head) static inline void fib_rule_put_rcu(struct rcu_head *head)
{ {
struct fib_rule *rule = container_of(head, struct fib_rule, rcu); struct fib_rule *rule = container_of(head, struct fib_rule, rcu);
release_net(rule->fr_net);
kfree(rule); kfree(rule);
} }
......
...@@ -29,7 +29,7 @@ int fib_default_rule_add(struct fib_rules_ops *ops, ...@@ -29,7 +29,7 @@ int fib_default_rule_add(struct fib_rules_ops *ops,
r->pref = pref; r->pref = pref;
r->table = table; r->table = table;
r->flags = flags; r->flags = flags;
r->fr_net = ops->fro_net; r->fr_net = hold_net(ops->fro_net);
/* The lock is not required here, the list in unreacheable /* The lock is not required here, the list in unreacheable
* at the moment this function is called */ * at the moment this function is called */
...@@ -243,7 +243,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) ...@@ -243,7 +243,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
err = -ENOMEM; err = -ENOMEM;
goto errout; goto errout;
} }
rule->fr_net = net; rule->fr_net = hold_net(net);
if (tb[FRA_PRIORITY]) if (tb[FRA_PRIORITY])
rule->pref = nla_get_u32(tb[FRA_PRIORITY]); rule->pref = nla_get_u32(tb[FRA_PRIORITY]);
...@@ -344,6 +344,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) ...@@ -344,6 +344,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
return 0; return 0;
errout_free: errout_free:
release_net(rule->fr_net);
kfree(rule); kfree(rule);
errout: errout:
rules_ops_put(ops); rules_ops_put(ops);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册