From: Gao feng Date: Sun, 11 Sep 2011 15:36:05 +0000 (+0000) Subject: fib:fix BUG_ON in fib_nl_newrule when add new fib rule X-Git-Tag: v3.0.5~68 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=cbab190c501c8034b82e0dd9da7fdb4b75e08daa;p=karo-tx-linux.git fib:fix BUG_ON in fib_nl_newrule when add new fib rule [ Upstream commit 561dac2d410ffac0b57a23b85ae0a623c1a076ca ] 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 Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 008dc70b064b..f39ef5c6084b 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) */ list_for_each_entry(r, &ops->rules_list, list) { if (r->action == FR_ACT_GOTO && - r->target == rule->pref) { - BUG_ON(rtnl_dereference(r->ctarget) != NULL); + r->target == rule->pref && + rtnl_dereference(r->ctarget) == NULL) { rcu_assign_pointer(r->ctarget, rule); if (--ops->unresolved_rules == 0) break;