--- l/net/batman-adv/network-coding.c +++ n/net/batman-adv/network-coding.c @@ -341,10 +341,13 @@ batadv_nc_purge_orig_nc_nodes(struct bat struct batadv_nc_node *)) { struct batadv_nc_node *nc_node, *nc_node_tmp; + int i = 0; /* For each nc_node in list */ spin_lock_bh(lock); list_for_each_entry_safe(nc_node, nc_node_tmp, list, list) { + if (i++ == 2) + break; /* if an helper function has been passed as parameter, * ask it if the entry has to be purged or not */ @@ -403,12 +406,18 @@ static void batadv_nc_purge_orig_hash(st /* For each orig_node */ for (i = 0; i < hash->size; i++) { + unsigned long ts; + head = &hash->table[i]; rcu_read_lock(); - hlist_for_each_entry_rcu(orig_node, head, hash_entry) + ts = jiffies + 1; + hlist_for_each_entry_rcu(orig_node, head, hash_entry) { + if (time_after(jiffies, ts)) + break; batadv_nc_purge_orig(bat_priv, orig_node, batadv_nc_to_purge_nc_node); + } rcu_read_unlock(); } }