Skip to contentSkip to conversation

pull request for net: batman-adv 2017-12-15

PATCH In review Simon Wunderlich 2 participants 6 messages Dec 15, 2017 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover pull request for net: batman-adv 2017-12-15

Hi David,

here are a couple of fixes which we would like to see integrated into net.

Please pull or let me know of any problem!

Thank you,
Simon

The following changes since commit 4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323:

Linux 4.15-rc1 (2017-11-26 16:01:47 -0800)

are available in the git repository at:

git://git.open-mesh.org/linux-merge.git tags/batadv-net-for-davem-20171215

for you to fetch changes up to 5ba7dcfe77037b67016263ea597a8b431692ecab:

batman-adv: Fix lock for ogm cnt access in batadv_iv_ogm_calc_tq (2017-12-04 11:47:33 +0100)

----------------------------------------------------------------
Here are some batman-adv bugfixes:

- Initialize the fragment headers, by Sven Eckelmann

- Fix a NULL check in BATMAN V, by Sven Eckelmann

- Fix kernel doc for the time_setup() change, by Sven Eckelmann

- Use the right lock in BATMAN IV OGM Update, by Sven Eckelmann

----------------------------------------------------------------
Sven Eckelmann (4):
batman-adv: Always initialize fragment header priority
batman-adv: Fix check of retrieved orig_gw in batadv_v_gw_is_eligible
batman-adv: Fix kernel-doc for timer functions
batman-adv: Fix lock for ogm cnt access in batadv_iv_ogm_calc_tq

 net/batman-adv/bat_iv_ogm.c    | 4 ++--
 net/batman-adv/bat_v.c         | 2 +-
 net/batman-adv/fragmentation.c | 2 ++
 net/batman-adv/tp_meter.c      | 4 ++--
 4 files changed, 7 insertions(+), 5 deletions(-)

A message that is not in the archive (sent off-list or not yet received): 20171215113143.12852-1-sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org

#2 lore raw

PATCH 1/4 batman-adv: Always initialize fragment header priority

From: Sven Eckelmann <[email protected]>

The batman-adv unuicast fragment header contains 3 bits for the priority of the packet. These bits will be initialized when the skb->priority contains a value between 256 and 263. But otherwise, the uninitialized bits from the stack will be used.

Fixes c0f25c802b33 ("batman-adv: Include frame priority in fragment header")
---
 net/batman-adv/fragmentation.c | 2 ++
 1 file changed, 2 insertions(+)
net/batman-adv/fragmentation.c +2 -0
index a98cf1104a30..ebe6e38934e4 100644
@@ -499,6 +499,8 @@ int batadv_frag_send_packet(struct sk_buff *skb,
 	 */
 	if (skb->priority >= 256 && skb->priority <= 263)
 		frag_header.priority = skb->priority - 256;
+	else
+		frag_header.priority = 0;
 
 	ether_addr_copy(frag_header.orig, primary_if->net_dev->dev_addr);
 	ether_addr_copy(frag_header.dest, orig_node->orig);
Signature · 1 line
2.11.0
#3 lore raw

PATCH 2/4 batman-adv: Fix check of retrieved orig_gw in batadv_v_gw_is_eligible

In reply to a message not in the archive

From: Sven Eckelmann <[email protected]>

The batadv_v_gw_is_eligible function already assumes that orig_node is not NULL. But batadv_gw_node_get may have failed to find the originator. It must therefore be checked whether the batadv_gw_node_get failed and not whether orig_node is NULL to detect this error.

Fixes 50164d8f500f ("batman-adv: B.A.T.M.A.N. V - implement GW selection logic")
---
 net/batman-adv/bat_v.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/bat_v.c +1 -1
index 341ceab8338d..e0e2bfcd6b3e 100644
@@ -814,7 +814,7 @@ static bool batadv_v_gw_is_eligible(struct batadv_priv *bat_priv,
 	}
 
 	orig_gw = batadv_gw_node_get(bat_priv, orig_node);
-	if (!orig_node)
+	if (!orig_gw)
 		goto out;
 
 	if (batadv_v_gw_throughput_get(orig_gw, &orig_throughput) < 0)
Signature · 1 line
2.11.0
#4 lore raw

PATCH 3/4 batman-adv: Fix kernel-doc for timer functions

In reply to a message not in the archive

From: Sven Eckelmann <[email protected]>

The commit e99e88a9d2b0 ("treewide: setup_timer() -> timer_setup()") changed the argument name and type of the timer function but didn't adjust the kernel-doc of these functions.

---
 net/batman-adv/tp_meter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/batman-adv/tp_meter.c +2 -2
index 15cd2139381e..ebc4e2241c77 100644
@@ -482,7 +482,7 @@ static void batadv_tp_reset_sender_timer(struct batadv_tp_vars *tp_vars)
 
 /**
  * batadv_tp_sender_timeout - timer that fires in case of packet loss
- * @arg: address of the related tp_vars
+ * @t: address to timer_list inside tp_vars
  *
  * If fired it means that there was packet loss.
  * Switch to Slow Start, set the ss_threshold to half of the current cwnd and
@@ -1106,7 +1106,7 @@ static void batadv_tp_reset_receiver_timer(struct batadv_tp_vars *tp_vars)
 /**
  * batadv_tp_receiver_shutdown - stop a tp meter receiver when timeout is
  *  reached without received ack
- * @arg: address of the related tp_vars
+ * @t: address to timer_list inside tp_vars
  */
 static void batadv_tp_receiver_shutdown(struct timer_list *t)
 {
Signature · 1 line
2.11.0
#5 lore raw

PATCH 4/4 batman-adv: Fix lock for ogm cnt access in batadv_iv_ogm_calc_tq

In reply to a message not in the archive

From: Sven Eckelmann <[email protected]>

The originator node object orig_neigh_node is used to when accessing the bcast_own(_sum) and real_packet_count information. The access to them has to be protected with the spinlock in orig_neigh_node.

But the function uses the lock in orig_node instead. This is incorrect because they could be two different originator node objects.

Fixes 0ede9f41b217 ("batman-adv: protect bit operations to count OGMs with spinlock")
---
 net/batman-adv/bat_iv_ogm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/batman-adv/bat_iv_ogm.c +2 -2
index 1b659ab652fb..bbe8414b6ee7 100644
@@ -1214,7 +1214,7 @@ static bool batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node,
 	orig_node->last_seen = jiffies;
 
 	/* find packet count of corresponding one hop neighbor */
-	spin_lock_bh(&orig_node->bat_iv.ogm_cnt_lock);
+	spin_lock_bh(&orig_neigh_node->bat_iv.ogm_cnt_lock);
 	if_num = if_incoming->if_num;
 	orig_eq_count = orig_neigh_node->bat_iv.bcast_own_sum[if_num];
 	neigh_ifinfo = batadv_neigh_ifinfo_new(neigh_node, if_outgoing);
@@ -1224,7 +1224,7 @@ static bool batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node,
 	} else {
 		neigh_rq_count = 0;
 	}
-	spin_unlock_bh(&orig_node->bat_iv.ogm_cnt_lock);
+	spin_unlock_bh(&orig_neigh_node->bat_iv.ogm_cnt_lock);
 
 	/* pay attention to not get a value bigger than 100 % */
 	if (orig_eq_count > neigh_rq_count)
Signature · 1 line
2.11.0