Skip to contentSkip to conversation

: Fix fib_rules dump race

NET Applied Patrick McHardy 3 participants 3 messages Mar 22, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

[NET]: Fix fib_rules dump race

fib_rules_dump needs to use list_for_each_entry_rcu to protect against concurrent changes to the rules list.

net/core/fib_rules.c +1 -1
index 215f1bf..3aea4e8 100644
@@ -374,7 +374,7 @@ int fib_rules_dump(struct sk_buff *skb, struct netlink_callback *cb, int family)
 		return -EAFNOSUPPORT;
 
 	rcu_read_lock();
-	list_for_each_entry(rule, ops->rules_list, list) {
+	list_for_each_entry_rcu(rule, ops->rules_list, list) {
 		if (idx < cb->args[0])
 			goto skip;
 
#1 lore raw

* Patrick McHardy <[email protected]> 2007-03-22 15:38

Quoted 4 lines

[NET]: Fix fib_rules dump race

fib_rules_dump needs to use list_for_each_entry_rcu to protect against concurrent changes to the rules list.

Good catch, it's not serialized with add/del by rtnl mutex if the dump gets interrupted.