b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH 0/4] pull request for net: batman-adv 2017-12-15
@ 2017-12-15 11:31 Simon Wunderlich
  2017-12-15 11:31 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Always initialize fragment header priority Simon Wunderlich
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Simon Wunderlich @ 2017-12-15 11:31 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Simon Wunderlich

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(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Always initialize fragment header priority
  2017-12-15 11:31 [B.A.T.M.A.N.] [PATCH 0/4] pull request for net: batman-adv 2017-12-15 Simon Wunderlich
@ 2017-12-15 11:31 ` Simon Wunderlich
  2017-12-15 11:31 ` [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: Fix check of retrieved orig_gw in batadv_v_gw_is_eligible Simon Wunderlich
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Simon Wunderlich @ 2017-12-15 11:31 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Simon Wunderlich

From: Sven Eckelmann <sven.eckelmann@open-mesh.com>

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")
Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/fragmentation.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index a98cf1104a30..ebe6e38934e4 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -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);
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: Fix check of retrieved orig_gw in batadv_v_gw_is_eligible
  2017-12-15 11:31 [B.A.T.M.A.N.] [PATCH 0/4] pull request for net: batman-adv 2017-12-15 Simon Wunderlich
  2017-12-15 11:31 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Always initialize fragment header priority Simon Wunderlich
@ 2017-12-15 11:31 ` Simon Wunderlich
  2017-12-15 11:31 ` [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: Fix kernel-doc for timer functions Simon Wunderlich
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Simon Wunderlich @ 2017-12-15 11:31 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Simon Wunderlich

From: Sven Eckelmann <sven.eckelmann@openmesh.com>

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")
Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
Acked-by: Antonio Quartulli <a@unstable.cc>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/bat_v.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
index 341ceab8338d..e0e2bfcd6b3e 100644
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -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)
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: Fix kernel-doc for timer functions
  2017-12-15 11:31 [B.A.T.M.A.N.] [PATCH 0/4] pull request for net: batman-adv 2017-12-15 Simon Wunderlich
  2017-12-15 11:31 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Always initialize fragment header priority Simon Wunderlich
  2017-12-15 11:31 ` [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: Fix check of retrieved orig_gw in batadv_v_gw_is_eligible Simon Wunderlich
@ 2017-12-15 11:31 ` Simon Wunderlich
  2017-12-15 11:31 ` [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Fix lock for ogm cnt access in batadv_iv_ogm_calc_tq Simon Wunderlich
  2017-12-15 16:02 ` [B.A.T.M.A.N.] [PATCH 0/4] pull request for net: batman-adv 2017-12-15 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Simon Wunderlich @ 2017-12-15 11:31 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Simon Wunderlich

From: Sven Eckelmann <sven@narfation.org>

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.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/tp_meter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c
index 15cd2139381e..ebc4e2241c77 100644
--- a/net/batman-adv/tp_meter.c
+++ b/net/batman-adv/tp_meter.c
@@ -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)
 {
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Fix lock for ogm cnt access in batadv_iv_ogm_calc_tq
  2017-12-15 11:31 [B.A.T.M.A.N.] [PATCH 0/4] pull request for net: batman-adv 2017-12-15 Simon Wunderlich
                   ` (2 preceding siblings ...)
  2017-12-15 11:31 ` [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: Fix kernel-doc for timer functions Simon Wunderlich
@ 2017-12-15 11:31 ` Simon Wunderlich
  2017-12-15 16:02 ` [B.A.T.M.A.N.] [PATCH 0/4] pull request for net: batman-adv 2017-12-15 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Simon Wunderlich @ 2017-12-15 11:31 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Simon Wunderlich

From: Sven Eckelmann <sven@narfation.org>

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")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/bat_iv_ogm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 1b659ab652fb..bbe8414b6ee7 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -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)
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 0/4] pull request for net: batman-adv 2017-12-15
  2017-12-15 11:31 [B.A.T.M.A.N.] [PATCH 0/4] pull request for net: batman-adv 2017-12-15 Simon Wunderlich
                   ` (3 preceding siblings ...)
  2017-12-15 11:31 ` [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Fix lock for ogm cnt access in batadv_iv_ogm_calc_tq Simon Wunderlich
@ 2017-12-15 16:02 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-12-15 16:02 UTC (permalink / raw)
  To: sw; +Cc: netdev, b.a.t.m.a.n

From: Simon Wunderlich <sw@simonwunderlich.de>
Date: Fri, 15 Dec 2017 12:31:39 +0100

> here are a couple of fixes which we would like to see integrated into net.
> 
> Please pull or let me know of any problem!

Pulled, thanks Simon.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-12-15 16:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-15 11:31 [B.A.T.M.A.N.] [PATCH 0/4] pull request for net: batman-adv 2017-12-15 Simon Wunderlich
2017-12-15 11:31 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Always initialize fragment header priority Simon Wunderlich
2017-12-15 11:31 ` [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: Fix check of retrieved orig_gw in batadv_v_gw_is_eligible Simon Wunderlich
2017-12-15 11:31 ` [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: Fix kernel-doc for timer functions Simon Wunderlich
2017-12-15 11:31 ` [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Fix lock for ogm cnt access in batadv_iv_ogm_calc_tq Simon Wunderlich
2017-12-15 16:02 ` [B.A.T.M.A.N.] [PATCH 0/4] pull request for net: batman-adv 2017-12-15 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).