From f63c54bba31d2c86269982fd8efdfb618f1daabe Mon Sep 17 00:00:00 2001
From: Ruben Wisniewski <ruben@freifunk-nrw.de>
Date: Tue, 26 May 2015 18:34:27 +0200
-Subject: [PATCH 01/10] batman-adv: Avoid u32 overflow during gateway select
+Subject: [PATCH 01/13] batman-adv: Avoid u32 overflow during gateway select
The gateway selection based on fast connections is using a single value
calculated from the average tq (0-255) and the download bandwidth (in
From 9bbd794030657fe0d38590cd67d4801b989cebf9 Mon Sep 17 00:00:00 2001
From: Antonio Quartulli <antonio@meshcoding.com>
Date: Mon, 1 Jun 2015 17:29:57 +0200
-Subject: [PATCH 02/10] batman-adv: avoid DAT to mess up LAN state
+Subject: [PATCH 02/13] batman-adv: avoid DAT to mess up LAN state
When a node running DAT receives an ARP request from the LAN for the
first time, it is likely that this node will request the ARP entry
From bfd0fbaef270ac4ed8e4457a38ef8d91190c0540 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
Date: Tue, 16 Jun 2015 17:10:22 +0200
-Subject: [PATCH 03/10] batman-adv: Make DAT capability changes atomic
+Subject: [PATCH 03/13] batman-adv: Make DAT capability changes atomic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From 586df9e2537b51c0df7ce99576c3cee1681b64de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
Date: Tue, 16 Jun 2015 17:10:23 +0200
-Subject: [PATCH 04/10] batman-adv: Make NC capability changes atomic
+Subject: [PATCH 04/13] batman-adv: Make NC capability changes atomic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From a51fa16ecf3f079518baaa56bffae343bd5694f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
Date: Tue, 16 Jun 2015 17:10:24 +0200
-Subject: [PATCH 05/10] batman-adv: Make TT capability changes atomic
+Subject: [PATCH 05/13] batman-adv: Make TT capability changes atomic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From 201a54ba710ab7f40b82ad3c109f702c47d0761f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
Date: Tue, 16 Jun 2015 17:10:25 +0200
-Subject: [PATCH 06/10] batman-adv: Make MCAST capability changes atomic
+Subject: [PATCH 06/13] batman-adv: Make MCAST capability changes atomic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From 7f220ed1f063be00833bd34a013c8f3f45884031 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
Date: Tue, 16 Jun 2015 17:10:26 +0200
-Subject: [PATCH 07/10] batman-adv: Fix potential synchronization issues in
+Subject: [PATCH 07/13] batman-adv: Fix potential synchronization issues in
mcast tvlv handler
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
From 256776ef8562744f90ac9379364df4cf88291b49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
Date: Thu, 18 Jun 2015 06:47:19 +0200
-Subject: [PATCH 08/10] batman-adv: Fix compile error on deactivated MCAST
+Subject: [PATCH 08/13] batman-adv: Fix compile error on deactivated MCAST
feature
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
From 2c2dfd886a400057ccbc66f1507c94ed909d2a89 Mon Sep 17 00:00:00 2001
From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Tue, 9 Jun 2015 21:24:36 +0800
-Subject: [PATCH 09/10] batman-adv: fix kernel crash due to missing NULL checks
+Subject: [PATCH 09/13] batman-adv: fix kernel crash due to missing NULL checks
batadv_softif_vlan_get() may return NULL which has to be verified
by the caller.
From af912d77181f252e6fdd324592d006e30bc82909 Mon Sep 17 00:00:00 2001
From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Wed, 17 Jun 2015 20:01:36 +0800
-Subject: [PATCH 10/10] batman-adv: protect tt_local_entry from concurrent
+Subject: [PATCH 10/13] batman-adv: protect tt_local_entry from concurrent
delete events
The tt_local_entry deletion performed in batadv_tt_local_remove() was neither
--- /dev/null
+From 9bac35c1e4fab662522371f81147963e19693409 Mon Sep 17 00:00:00 2001
+From: Marek Lindner <mareklindner@neomailbox.ch>
+Date: Mon, 22 Jun 2015 00:36:28 +0800
+Subject: [PATCH 11/13] batman-adv: protect tt request from double deletion
+
+The list_del() calls were changed to list_del_init() to prevent
+an accidental double deletion in batadv_tt_req_node_new().
+
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+Acked-by: Antonio Quartulli <antonio@meshcoding.com>
+---
+ translation-table.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/translation-table.c b/translation-table.c
+index dfe8896..b6c0f52 100644
+--- a/translation-table.c
++++ b/translation-table.c
+@@ -2194,7 +2194,7 @@ static void batadv_tt_req_list_free(struct batadv_priv *bat_priv)
+ spin_lock_bh(&bat_priv->tt.req_list_lock);
+
+ list_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
+- list_del(&node->list);
++ list_del_init(&node->list);
+ kfree(node);
+ }
+
+@@ -2230,7 +2230,7 @@ static void batadv_tt_req_purge(struct batadv_priv *bat_priv)
+ list_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
+ if (batadv_has_timed_out(node->issued_at,
+ BATADV_TT_REQUEST_TIMEOUT)) {
+- list_del(&node->list);
++ list_del_init(&node->list);
+ kfree(node);
+ }
+ }
+@@ -2512,7 +2512,8 @@ out:
+ batadv_hardif_free_ref(primary_if);
+ if (ret && tt_req_node) {
+ spin_lock_bh(&bat_priv->tt.req_list_lock);
+- list_del(&tt_req_node->list);
++ /* list_del_init() verifies tt_req_node still is in the list */
++ list_del_init(&tt_req_node->list);
+ spin_unlock_bh(&bat_priv->tt.req_list_lock);
+ kfree(tt_req_node);
+ }
+@@ -2949,7 +2950,7 @@ static void batadv_handle_tt_response(struct batadv_priv *bat_priv,
+ list_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
+ if (!batadv_compare_eth(node->addr, resp_src))
+ continue;
+- list_del(&node->list);
++ list_del_init(&node->list);
+ kfree(node);
+ }
+
+--
+2.1.4
+
--- /dev/null
+From 3c92b633715b7eca80dc7a2347e0e4dbcce1f018 Mon Sep 17 00:00:00 2001
+From: Simon Wunderlich <simon@open-mesh.com>
+Date: Wed, 24 Jun 2015 14:50:19 +0200
+Subject: [PATCH 12/13] batman-adv: initialize up/down values when adding a
+ gateway
+
+Without this initialization, gateways which actually announce up/down
+bandwidth of 0/0 could be added. If these nodes get purged via
+_batadv_purge_orig() later, the gw_node structure does not get removed
+since batadv_gw_node_delete() updates the gw_node with up/down
+bandwidth of 0/0, and the updating function then discards the change
+and does not free gw_node.
+
+This results in leaking the gw_node structures, which references other
+structures: gw_node -> orig_node -> orig_node_ifinfo -> hardif. When
+removing the interface later, the open reference on the hardif may cause
+hangs with the infamous "unregister_netdevice: waiting for mesh1 to
+become free. Usage count = 1" message.
+
+Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
+Acked-by: Antonio Quartulli <antonio@meshcoding.com>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+---
+ gateway_client.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/gateway_client.c b/gateway_client.c
+index 3f32357..d8e3ead 100644
+--- a/gateway_client.c
++++ b/gateway_client.c
+@@ -419,6 +419,8 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv,
+
+ INIT_HLIST_NODE(&gw_node->list);
+ gw_node->orig_node = orig_node;
++ gw_node->bandwidth_down = ntohl(gateway->bandwidth_down);
++ gw_node->bandwidth_up = ntohl(gateway->bandwidth_up);
+ atomic_set(&gw_node->refcount, 1);
+
+ spin_lock_bh(&bat_priv->gw.list_lock);
+--
+2.1.4
+
--- /dev/null
+From 07bec2d4dec83f024baf166b95cf037be3a7eca5 Mon Sep 17 00:00:00 2001
+From: Simon Wunderlich <simon@open-mesh.com>
+Date: Wed, 24 Jun 2015 14:50:20 +0200
+Subject: [PATCH 13/13] batman-adv: remove broadcast packets scheduled for
+ purged outgoing if
+
+When an interface is purged, the broadcast packets scheduled for this
+interface should get purged as well.
+
+Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+---
+ send.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/send.c b/send.c
+index 23635bd..a7e84b2 100644
+--- a/send.c
++++ b/send.c
+@@ -598,7 +598,8 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
+ * we delete only packets belonging to the given interface
+ */
+ if ((hard_iface) &&
+- (forw_packet->if_incoming != hard_iface))
++ (forw_packet->if_incoming != hard_iface) &&
++ (forw_packet->if_outgoing != hard_iface))
+ continue;
+
+ spin_unlock_bh(&bat_priv->forw_bcast_list_lock);
+--
+2.1.4
+