* [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
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: fix old master freeing operation
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
0 siblings, 1 reply; 3+ messages in thread
From: Marek Lindner @ 2013-03-03 17:47 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Monday, March 04, 2013 01:34:36 Antonio Quartulli wrote:
> + if (master && master->netdev_ops->ndo_del_slave) {
> + ret = master->netdev_ops->ndo_del_slave(master,
> + hard_iface->net_dev
> );
Aren't we going to have compat trouble with this one ?
Cheers,
Marek
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: fix old master freeing operation
2013-03-03 17:47 ` Marek Lindner
@ 2013-03-03 21:01 ` Antonio Quartulli
0 siblings, 0 replies; 3+ messages in thread
From: Antonio Quartulli @ 2013-03-03 21:01 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
[-- Attachment #1: Type: text/plain, Size: 622 bytes --]
On Mon, Mar 04, 2013 at 01:47:05 +0800, Marek Lindner wrote:
> On Monday, March 04, 2013 01:34:36 Antonio Quartulli wrote:
> > + if (master && master->netdev_ops->ndo_del_slave) {
> > + ret = master->netdev_ops->ndo_del_slave(master,
> > + hard_iface->net_dev
> > );
>
> Aren't we going to have compat trouble with this one ?
Yes. Kernels before 2.6.39 do not have the ndo_del_slave() op.
We need a way to make this code compatible..
Cheers,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [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;
as well as URLs for NNTP newsgroup(s).