public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: fix old master freeing operation
@ 2013-03-03 17:34 Antonio Quartulli
  2013-03-03 17:47 ` Marek Lindner
  0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2013-03-03 17:34 UTC (permalink / raw)
  To: b.a.t.m.a.n

When a new hard_iface has a master already, ndo_del_slave
has to be used in order to let the old master perform its
cleaning up routing correctly. Unregistering the master
iface only could lead to a inconsistent state in the old
master knowledge.

Introduced by 5e57e3bff429cd403f0e30af69cf87a2cd55598f
("batman-adv: free an hard-interface before adding it").

Reported-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 hard-interface.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/hard-interface.c b/hard-interface.c
index fd99e42..f446e69 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -346,8 +346,15 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 	 * in that case unlink it first
 	 */
 	master = netdev_master_upper_dev_get(hard_iface->net_dev);
-	if (master)
-		netdev_upper_dev_unlink(hard_iface->net_dev, master);
+	if (master && master->netdev_ops->ndo_del_slave) {
+		ret = master->netdev_ops->ndo_del_slave(master,
+							hard_iface->net_dev);
+		if (ret < 0)
+			goto err_dev;
+	} else if (master) {
+		ret = -EINVAL;
+		goto err_dev;
+	}
 
 	hard_iface->soft_iface = soft_iface;
 	bat_priv = netdev_priv(hard_iface->soft_iface);
-- 
1.8.1.5


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

end of thread, other threads:[~2013-03-03 21:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-03 17:34 [B.A.T.M.A.N.] [PATCH] batman-adv: fix old master freeing operation Antonio Quartulli
2013-03-03 17:47 ` Marek Lindner
2013-03-03 21:01   ` Antonio Quartulli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox