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(a)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;
}
The tag, GregKH-20100216 has been created
at 2f51b1c529d9f3d5654e41e6e08b8ba769e786f7 (commit)
- Shortlog ------------------------------------------------------------
commit 2f51b1c529d9f3d5654e41e6e08b8ba769e786f7
Author: Simon Wunderlich <siwu(a)hrz.tu-chemnitz.de>
Date: Fri Jan 1 20:09:34 2010 +0000
Staging: batman-adv: fix unlock, make code sparse clean
If the skb failed to copy in the (batman) icmp receive handlers, the function
returned without unlocking the orig_hash_lock first. To prevent this,
the fields needed from the orig_node are now copied, and the copies are
used for sending (just like in other handlers).
Furthermore, find_batman_if() was declared static. The code now appears
to be clean in 'sparse' [1].
Thanks to Andrew Lunn for pointing that out.
[1] http://sparse.wiki.kernel.org/index.php/Main_Page
Signed-off-by: Simon Wunderlich <siwu(a)hrz.tu-chemnitz.de>
-----------------------------------------------------------------------
--
batman-adv
Author: simon
Date: 2010-02-14 16:05:18 +0100 (Sun, 14 Feb 2010)
New Revision: 1571
Modified:
trunk/batman-adv-kernelland/routing.c
Log:
batman-adv: bonding: don't ask hash when already found primary router
The probability is very high that we are already dealing with the primary
router when searching for a bonding candidate, so check if we are already found
it before searching with hash_find().
Signed-off-by: Simon Wunderlich <siwu(a)hrz.tu-chemnitz.de>
Modified: trunk/batman-adv-kernelland/routing.c
===================================================================
--- trunk/batman-adv-kernelland/routing.c 2010-02-13 14:55:59 UTC (rev 1570)
+++ trunk/batman-adv-kernelland/routing.c 2010-02-14 15:05:18 UTC (rev 1571)
@@ -937,11 +937,17 @@
return orig_node->router;
/* find the orig_node which has the primary interface. might
- * even be the same as our orig_node in many cases */
+ * even be the same as our router_orig in many cases */
- primary_orig_node = hash_find(orig_hash, router_orig->primary_addr);
- if (!primary_orig_node)
- return orig_node->router;
+ if (memcmp(router_orig->primary_addr,
+ router_orig->orig, ETH_ALEN) == 0) {
+ primary_orig_node = router_orig;
+ } else {
+ primary_orig_node = hash_find(orig_hash,
+ router_orig->primary_addr);
+ if (!primary_orig_node)
+ return orig_node->router;
+ }
/* with less than 2 candidates, we can't do any
* bonding and prefer the original router. */