Skip to content

Commit

Permalink
Staging: batman-adv: Always protect list_for_each_entry_rcu with RCU
Browse files Browse the repository at this point in the history
receive_bat_packet is not called with rcu_read_lock so we must ensure by
ourself that we protect list_for_each_entry_rcu using the correct RCU
locks.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Sven Eckelmann authored and Greg Kroah-Hartman committed Sep 20, 2010
1 parent af2ac7b commit 2250840
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/batman-adv/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ void receive_bat_packet(struct ethhdr *ethhdr,
batman_packet->tq, batman_packet->ttl, batman_packet->version,
has_directlink_flag);

rcu_read_lock();
list_for_each_entry_rcu(batman_if, &if_list, list) {
if (batman_if->if_status != IF_ACTIVE)
continue;
Expand All @@ -585,6 +586,7 @@ void receive_bat_packet(struct ethhdr *ethhdr,
if (compare_orig(ethhdr->h_source, broadcast_addr))
is_broadcast = 1;
}
rcu_read_unlock();

if (batman_packet->version != COMPAT_VERSION) {
bat_dbg(DBG_BATMAN, bat_priv,
Expand Down

0 comments on commit 2250840

Please sign in to comment.