diff options
author | Gao feng <gaofeng@cn.fujitsu.com> | 2011-09-11 11:36:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-09-21 15:16:40 -0400 |
commit | 561dac2d410ffac0b57a23b85ae0a623c1a076ca (patch) | |
tree | 5cdb1bf0e346f29f232b7b7fb9cf24211141502e | |
parent | b811ce9104a7f7663ddae4f7795a194a103b8f90 (diff) |
fib:fix BUG_ON in fib_nl_newrule when add new fib rule
add new fib rule can cause BUG_ON happen
the reproduce shell is
ip rule add pref 38
ip rule add pref 38
ip rule add to 192.168.3.0/24 goto 38
ip rule del pref 38
ip rule add to 192.168.3.0/24 goto 38
ip rule add pref 38
then the BUG_ON will happen
del BUG_ON and use (ctarget == NULL) identify whether this rule is unresolved
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/fib_rules.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index e7ab0c0285b5..3231b468bb72 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -384,8 +384,8 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | |||
384 | */ | 384 | */ |
385 | list_for_each_entry(r, &ops->rules_list, list) { | 385 | list_for_each_entry(r, &ops->rules_list, list) { |
386 | if (r->action == FR_ACT_GOTO && | 386 | if (r->action == FR_ACT_GOTO && |
387 | r->target == rule->pref) { | 387 | r->target == rule->pref && |
388 | BUG_ON(rtnl_dereference(r->ctarget) != NULL); | 388 | rtnl_dereference(r->ctarget) == NULL) { |
389 | rcu_assign_pointer(r->ctarget, rule); | 389 | rcu_assign_pointer(r->ctarget, rule); |
390 | if (--ops->unresolved_rules == 0) | 390 | if (--ops->unresolved_rules == 0) |
391 | break; | 391 | break; |