[commits] r1578 - trunk/batman-adv-kernelland

postmaster at open-mesh.net postmaster at open-mesh.net
Sat Feb 27 06:56:43 CET 2010


Author: marek
Date: 2010-02-27 06:56:18 +0100 (Sat, 27 Feb 2010)
New Revision: 1578

Modified:
   trunk/batman-adv-kernelland/soft-interface.c
Log:
batman-adv: only modify hna-table on active module

If we haven't set the module to MODULE_ACTIVE state before (in general,
no interface has yet been added to batman-adv) then the hna table is not
initialised yet. If the kernel changes the mac address of the bat0
interface at this moment then an hna_local_add() called by interface_set_mac_addr()
then resulted in a null pointer derefernce. With this patch we are now
explicitly checking before if the state is MODULE_ACTIVE right now so
that we can assume having an initialised hna table.

Signed-off-by: Linus L?\195?\188ssing <linus.luessing at web.de>

Modified: trunk/batman-adv-kernelland/soft-interface.c
===================================================================
--- trunk/batman-adv-kernelland/soft-interface.c	2010-02-26 06:02:34 UTC (rev 1577)
+++ trunk/batman-adv-kernelland/soft-interface.c	2010-02-27 05:56:18 UTC (rev 1578)
@@ -154,9 +154,13 @@
 	if (!is_valid_ether_addr(addr->sa_data))
 		return -EADDRNOTAVAIL;
 
-	hna_local_remove(dev->dev_addr, "mac address changed");
+	/* only modify hna-table if it has been initialised before */
+	if (atomic_read(&module_state) == MODULE_ACTIVE) {
+		hna_local_remove(dev->dev_addr, "mac address changed");
+		hna_local_add(addr->sa_data);
+	}
+
 	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-	hna_local_add(dev->dev_addr);
 
 	return 0;
 }



More information about the commits mailing list