diff options
author | Denis V. Lunev <den@openvz.org> | 2007-11-11 01:12:03 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-11-11 01:12:03 -0500 |
commit | 2994c63863ac350c4c8c6a65d8110749c2abb95c (patch) | |
tree | 5509f71222641098683df1b1e0ff7bdfc2758b2c /net/decnet/dn_rules.c | |
parent | 33d36bb83c5b566c98a441e791736e25dbc35fc3 (diff) |
[INET]: Small possible memory leak in FIB rules
This patch fixes a small memory leak. Default fib rules can be deleted by
the user if the rule does not carry FIB_RULE_PERMANENT flag, f.e. by
ip rule flush
Such a rule will not be freed as the ref-counter has 2 on start and becomes
clearly unreachable after removal.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet/dn_rules.c')
-rw-r--r-- | net/decnet/dn_rules.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c index ddd3f04f0919..ffebea04cc99 100644 --- a/net/decnet/dn_rules.c +++ b/net/decnet/dn_rules.c | |||
@@ -48,15 +48,6 @@ struct dn_fib_rule | |||
48 | u8 flags; | 48 | u8 flags; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static struct dn_fib_rule default_rule = { | ||
52 | .common = { | ||
53 | .refcnt = ATOMIC_INIT(2), | ||
54 | .pref = 0x7fff, | ||
55 | .table = RT_TABLE_MAIN, | ||
56 | .action = FR_ACT_TO_TBL, | ||
57 | }, | ||
58 | }; | ||
59 | |||
60 | 51 | ||
61 | int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res) | 52 | int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res) |
62 | { | 53 | { |
@@ -262,8 +253,8 @@ static struct fib_rules_ops dn_fib_rules_ops = { | |||
262 | 253 | ||
263 | void __init dn_fib_rules_init(void) | 254 | void __init dn_fib_rules_init(void) |
264 | { | 255 | { |
265 | list_add_tail(&default_rule.common.list, | 256 | BUG_ON(fib_default_rule_add(&dn_fib_rules_ops, 0x7fff, |
266 | &dn_fib_rules_ops.rules_list); | 257 | RT_TABLE_MAIN, 0)); |
267 | fib_rules_register(&dn_fib_rules_ops); | 258 | fib_rules_register(&dn_fib_rules_ops); |
268 | } | 259 | } |
269 | 260 | ||