Skip to content

Commit 27a4d5e

Browse files
Simon Wunderlichordex
authored andcommitted
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 <[email protected]> Signed-off-by: Marek Lindner <[email protected]> Signed-off-by: Antonio Quartulli <[email protected]>
1 parent ef72706 commit 27a4d5e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/batman-adv/gateway_client.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,8 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv,
439439

440440
INIT_HLIST_NODE(&gw_node->list);
441441
gw_node->orig_node = orig_node;
442+
gw_node->bandwidth_down = ntohl(gateway->bandwidth_down);
443+
gw_node->bandwidth_up = ntohl(gateway->bandwidth_up);
442444
atomic_set(&gw_node->refcount, 1);
443445

444446
spin_lock_bh(&bat_priv->gw.list_lock);

0 commit comments

Comments
 (0)