[3/4] batman-adv: Always protect list_for_each_entry_rcu with RCU

Message ID 1284668317-19890-4-git-send-email-sven.eckelmann@gmx.de (mailing list archive)
State Superseded, archived
Headers

Commit Message

Sven Eckelmann Sept. 16, 2010, 8:18 p.m. UTC
  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>
---
 batman-adv/routing.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
  

Patch

diff --git a/batman-adv/routing.c b/batman-adv/routing.c
index 603a932..1781b7e 100644
--- a/batman-adv/routing.c
+++ b/batman-adv/routing.c
@@ -575,6 +575,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;
@@ -597,6 +598,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,