The following commit has been merged in the merge/master branch:
commit 4a73d7438dfb60c7ac82758875292bc14f363b45
Author: Simon Wunderlich <sw(a)simonwunderlich.de>
Date: Wed Sep 2 20:09:55 2015 +0200
batman-adv: avoid keeping false temporary entry
In the case when a temporary entry is added first and a proper tt entry
is added after that, the temporary tt entry is kept in the orig list.
However the temporary flag is removed at this point, and therefore the
purge function can not find this temporary entry anymore.
Therefore, remove the previous temp entry before adding the new proper
one.
This case can happen if a client behind a given originator moves before
the TT announcement is sent out. Other than that, this case can also be
created by bogus or malicious payload frames for VLANs which are not
existent on the sending originator.
Reported-by: Alessandro Bolletta <alessandro(a)mediaspot.net>
Signed-off-by: Simon Wunderlich <sw(a)simonwunderlich.de>
Acked-by: Antonio Quartulli <antonio(a)meshcoding.com>
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 39283ff..9ac1a46 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -1419,9 +1419,15 @@ static bool batadv_tt_global_add(struct batadv_priv *bat_priv,
}
/* if the client was temporary added before receiving the first
- * OGM announcing it, we have to clear the TEMP flag
+ * OGM announcing it, we have to clear the TEMP flag. Also,
+ * remove the previous temporary orig node and re-add it
+ * if required. If the orig entry changed, the new one which
+ * is a non-temporary entry is preferred.
*/
- common->flags &= ~BATADV_TT_CLIENT_TEMP;
+ if (common->flags & BATADV_TT_CLIENT_TEMP) {
+ batadv_tt_global_del_orig_list(tt_global_entry);
+ common->flags &= ~BATADV_TT_CLIENT_TEMP;
+ }
/* the change can carry possible "attribute" flags like the
* TT_CLIENT_WIFI, therefore they have to be copied in the
--
The following commit has been merged in the merge/master branch:
commit 2dd1d9f06ac1208b1921aa90d479c3940bc70b4f
Author: Simon Wunderlich <sw(a)simonwunderlich.de>
Date: Wed Sep 2 20:09:56 2015 +0200
batman-adv: detect local excess vlans in TT request
If the local representation of the global TT table of one originator has
more VLAN entries than the respective TT update, there is some
inconsistency present. By detecting and reporting this inconsistency,
the global table gets updated and the excess VLAN will get removed in
the process.
Reported-by: Alessandro Bolletta <alessandro(a)mediaspot.net>
Signed-off-by: Simon Wunderlich <sw(a)simonwunderlich.de>
Acked-by: Antonio Quartulli <antonio(a)meshcoding.com>
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 9ac1a46..7e4657e 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -2394,8 +2394,8 @@ static bool batadv_tt_global_check_crc(struct batadv_orig_node *orig_node,
{
struct batadv_tvlv_tt_vlan_data *tt_vlan_tmp;
struct batadv_orig_node_vlan *vlan;
+ int i, orig_num_vlan;
uint32_t crc;
- int i;
/* check if each received CRC matches the locally stored one */
for (i = 0; i < num_vlan; i++) {
@@ -2421,6 +2421,18 @@ static bool batadv_tt_global_check_crc(struct batadv_orig_node *orig_node,
return false;
}
+ /* check if any excess VLANs exist locally for the originator
+ * which are not mentioned in the TVLV from the originator.
+ */
+ rcu_read_lock();
+ orig_num_vlan = 0;
+ list_for_each_entry_rcu(vlan, &orig_node->vlan_list, list)
+ orig_num_vlan++;
+ rcu_read_unlock();
+
+ if (orig_num_vlan > num_vlan)
+ return false;
+
return true;
}
--
The following commit has been merged in the merge/master branch:
commit e821b76b67a0adcbb807ee29c930bb43c3d434d8
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Sat Aug 8 02:46:45 2015 +0200
batman-adv: Mark batadv_hardif_neigh_free_now as static
batadv_hardif_neigh_free_now is not used outside of originator.c and should
thus be marked as static.
Fixes: fed2826b490c ("batman-adv: add list of unique single hop neighbors per hard-interface")
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 06f2d19..3c782a33 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -224,7 +224,8 @@ static void batadv_hardif_neigh_free_rcu(struct rcu_head *rcu)
* and possibly free it (without rcu callback)
* @hardif_neigh: hardif neigh neighbor to free
*/
-void batadv_hardif_neigh_free_now(struct batadv_hardif_neigh_node *hardif_neigh)
+static void
+batadv_hardif_neigh_free_now(struct batadv_hardif_neigh_node *hardif_neigh)
{
if (atomic_dec_and_test(&hardif_neigh->refcount))
batadv_hardif_neigh_free_rcu(&hardif_neigh->rcu);
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h
index 8436eb9..2955775 100644
--- a/net/batman-adv/originator.h
+++ b/net/batman-adv/originator.h
@@ -46,8 +46,6 @@ batadv_hardif_neigh_get(const struct batadv_hard_iface *hard_iface,
const u8 *neigh_addr);
void
batadv_hardif_neigh_free_ref(struct batadv_hardif_neigh_node *hardif_neigh);
-void
-batadv_hardif_neigh_free_now(struct batadv_hardif_neigh_node *hardif_neigh);
struct batadv_neigh_node *
batadv_neigh_node_new(struct batadv_orig_node *orig_node,
struct batadv_hard_iface *hard_iface,
--
The following commit has been merged in the merge/master branch:
commit a0f15fc75c8c8009d2130cf95098c7970656dfc1
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Sat Aug 8 02:37:01 2015 +0200
batman-adv: Mark batadv_iv_neigh_print as static
batadv_iv_neigh_print is not used outside of bat_iv_ogm.c and should thus
be marked as static.
Fixes: 2e1133841c44 ("batman-adv: export single hop neighbor list via debugfs")
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 5f76d22..5677169 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -1895,7 +1895,8 @@ batadv_iv_hardif_neigh_print(struct seq_file *seq,
* @bat_priv: the bat priv with all the soft interface information
* @seq: neighbour table seq_file struct
*/
-void batadv_iv_neigh_print(struct batadv_priv *bat_priv, struct seq_file *seq)
+static void batadv_iv_neigh_print(struct batadv_priv *bat_priv,
+ struct seq_file *seq)
{
struct net_device *net_dev = (struct net_device *)seq->private;
struct batadv_hardif_neigh_node *hardif_neigh;
--
The following commit has been merged in the merge/master branch:
commit fff4c8303f5e09bed4cfdb45615a3b6b4cd70b6d
Merge: e821b76b67a0adcbb807ee29c930bb43c3d434d8 071aadbb05e4f6ff1c25c5b1ef58f5158d31a8ac
Author: Marek Lindner <mareklindner(a)neomailbox.ch>
Date: Sun Aug 30 17:58:13 2015 +0800
Merge branch 'next'
--
The following commit has been merged in the merge/master branch:
commit 0804b622d434046a7473827f39c77f55267f81eb
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Sat Aug 8 02:31:49 2015 +0200
batman-adv: Add missing include spinlock.h
Fixes: fed2826b490c ("batman-adv: add list of unique single hop neighbors per hard-interface")
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 5c2df84..a8cb985 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -32,6 +32,7 @@
#include <linux/rculist.h>
#include <linux/rtnetlink.h>
#include <linux/slab.h>
+#include <linux/spinlock.h>
#include <linux/workqueue.h>
#include <net/net_namespace.h>
--
The following commit has been merged in the merge/master branch:
commit dba67bc80fbfe6a28fc3c1141cca1c556ab7e499
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Tue Aug 18 13:37:01 2015 +0200
batman-adv: Fix memory leak on tt add with invalid vlan
The object tt_local is allocated with kmalloc and not initialized when the
function batadv_tt_local_add checks for the vlan. But this function can
only cleanup the object when the (not yet initialized) reference counter of
the object is 1. This is unlikely and thus the object would leak when the
vlan could not be found.
Instead the uninitialized object tt_local has to be freed manually and the
pointer has to set to NULL to avoid calling the function which would try to
decrement the reference counter of the not existing object.
CID: 1316518
Fixes: 354136bcc3c4 ("batman-adv: fix kernel crash due to missing NULL checks")
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 7986ec5..39283ff 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -595,8 +595,11 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
/* increase the refcounter of the related vlan */
vlan = batadv_softif_vlan_get(bat_priv, vid);
if (WARN(!vlan, "adding TT local entry %pM to non-existent VLAN %d",
- addr, BATADV_PRINT_VID(vid)))
+ addr, BATADV_PRINT_VID(vid))) {
+ kfree(tt_local);
+ tt_local = NULL;
goto out;
+ }
batadv_dbg(BATADV_DBG_TT, bat_priv,
"Creating new local tt entry: %pM (vid: %d, ttvn: %d)\n",
--
The following commit has been merged in the merge/master branch:
commit af3558688698479a56034f0fcbca164be2052aa8
Author: Linus Lüssing <linus.luessing(a)c0d3.blue>
Date: Fri Aug 14 17:23:48 2015 +0200
batman-adv: Remove unnecessary braces for test_bit() in DAT
Fixes: de466678 ("batman-adv: Fix broken DAT capability check")
Signed-off-by: Linus Lüssing <linus.luessing(a)c0d3.blue>
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index 1caf7d2..63243a3 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -453,7 +453,7 @@ static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res,
int j;
/* check if orig node candidate is running DAT */
- if (!(test_bit(BATADV_ORIG_CAPA_HAS_DAT, &candidate->capabilities)))
+ if (!test_bit(BATADV_ORIG_CAPA_HAS_DAT, &candidate->capabilities))
goto out;
/* Check if this node has already been selected... */
--