public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@meshcoding.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Simon Wunderlich <simon@open-mesh.com>,
	b.a.t.m.a.n@lists.open-mesh.org,
	Marek Lindner <mareklindner@neomailbox.ch>,
	Antonio Quartulli <antonio@meshcoding.com>
Subject: [B.A.T.M.A.N.] [PATCH 12/14] batman-adv: initialize up/down values when adding a gateway
Date: Tue,  4 Aug 2015 18:35:32 +0200	[thread overview]
Message-ID: <1438706134-3492-13-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <1438706134-3492-1-git-send-email-antonio@meshcoding.com>

From: Simon Wunderlich <simon@open-mesh.com>

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>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
 net/batman-adv/gateway_client.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 4ac24d8..6012e2b 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -435,6 +435,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.5.0


  parent reply	other threads:[~2015-08-04 16:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04 16:35 [B.A.T.M.A.N.] pull request [net]: batman-adv 20150804 Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 01/14] batman-adv: Replace gw_reselect divisor with simple shift Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 02/14] batman-adv: Avoid u32 overflow during gateway select Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 03/14] batman-adv: avoid DAT to mess up LAN state Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 04/14] batman-adv: Make DAT capability changes atomic Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 05/14] batman-adv: Make NC " Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 06/14] batman-adv: Make TT " Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 07/14] batman-adv: Make MCAST " Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 08/14] batman-adv: Fix potential synchronization issues in mcast tvlv handler Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 09/14] batman-adv: fix kernel crash due to missing NULL checks Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 10/14] batman-adv: protect tt_local_entry from concurrent delete events Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 11/14] batman-adv: protect tt request from double deletion Antonio Quartulli
2015-08-04 16:35 ` Antonio Quartulli [this message]
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 13/14] batman-adv: remove broadcast packets scheduled for purged outgoing if Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 14/14] batman-adv: Fix potentially broken skb network header access Antonio Quartulli
2015-08-04 19:40 ` [B.A.T.M.A.N.] pull request [net]: batman-adv 20150804 David Miller
2015-08-04 19:50   ` Antonio Quartulli
2015-08-04 20:25     ` Sven Eckelmann
2015-08-04 22:28       ` Antonio Quartulli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438706134-3492-13-git-send-email-antonio@meshcoding.com \
    --to=antonio@meshcoding.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=mareklindner@neomailbox.ch \
    --cc=netdev@vger.kernel.org \
    --cc=simon@open-mesh.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox