diff options
-rw-r--r-- | include/net/fib_rules.h | 1 | ||||
-rw-r--r-- | net/core/fib_rules.c | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index 34349f9f4331..a5c6ccc5bb19 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h | |||
@@ -87,6 +87,7 @@ static inline void fib_rule_get(struct fib_rule *rule) | |||
87 | static inline void fib_rule_put_rcu(struct rcu_head *head) | 87 | static inline void fib_rule_put_rcu(struct rcu_head *head) |
88 | { | 88 | { |
89 | struct fib_rule *rule = container_of(head, struct fib_rule, rcu); | 89 | struct fib_rule *rule = container_of(head, struct fib_rule, rcu); |
90 | release_net(rule->fr_net); | ||
90 | kfree(rule); | 91 | kfree(rule); |
91 | } | 92 | } |
92 | 93 | ||
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 540c07283e31..e3e9ab0f74e3 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -29,7 +29,7 @@ int fib_default_rule_add(struct fib_rules_ops *ops, | |||
29 | r->pref = pref; | 29 | r->pref = pref; |
30 | r->table = table; | 30 | r->table = table; |
31 | r->flags = flags; | 31 | r->flags = flags; |
32 | r->fr_net = ops->fro_net; | 32 | r->fr_net = hold_net(ops->fro_net); |
33 | 33 | ||
34 | /* The lock is not required here, the list in unreacheable | 34 | /* The lock is not required here, the list in unreacheable |
35 | * at the moment this function is called */ | 35 | * 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 | err = -ENOMEM; | 243 | err = -ENOMEM; |
244 | goto errout; | 244 | goto errout; |
245 | } | 245 | } |
246 | rule->fr_net = net; | 246 | rule->fr_net = hold_net(net); |
247 | 247 | ||
248 | if (tb[FRA_PRIORITY]) | 248 | if (tb[FRA_PRIORITY]) |
249 | rule->pref = nla_get_u32(tb[FRA_PRIORITY]); | 249 | 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 | return 0; | 344 | return 0; |
345 | 345 | ||
346 | errout_free: | 346 | errout_free: |
347 | release_net(rule->fr_net); | ||
347 | kfree(rule); | 348 | kfree(rule); |
348 | errout: | 349 | errout: |
349 | rules_ops_put(ops); | 350 | rules_ops_put(ops); |