* [B.A.T.M.A.N.] [PATCH maint] batman-adv: fix interface clean up on error
@ 2013-03-24 12:00 Antonio Quartulli
2013-03-24 18:30 ` Antonio Quartulli
0 siblings, 1 reply; 2+ messages in thread
From: Antonio Quartulli @ 2013-03-24 12:00 UTC (permalink / raw)
To: b.a.t.m.a.n
When enabling an hard_iface for the first time, the
hard_iface->soft_iface member is initialised with the newly
created soft_iface.
However, in case of error during the activation procedure
this member has to be set to NULL again, otherwise the
hard_iface will result busy and will not be possible to use
it anymore
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
it is possible to easily reproduce the bug without the patch:
$ batctl if add eth0
$ brctl addbr br0
$ brctl addif br0 bat0
$ batctl if add br0
Error - can't write to file '/sys/class/net/br0/batman_adv/mesh_iface': Device or resource busy
$ batctl if add br0
$
[no error anymore because br0 is already "associated" to bat0 and check at
sysfs.c:575 evaluates to true]
with the patch:
$ batctl if add eth0
$ brctl addbr br0
$ brctl addif br0 bat0
$ batctl if add br0
Error - can't write to file '/sys/class/net/br0/batman_adv/mesh_iface': Device or resource busy
$ batctl if add br0
Error - can't write to file '/sys/class/net/br0/batman_adv/mesh_iface': Device or resource busy
$
Cheers,
hard-interface.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hard-interface.c b/hard-interface.c
index 368219e..70bc9ce 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -402,6 +402,7 @@ out:
return 0;
err_dev:
+ hard_iface->soft_iface = NULL;
dev_put(soft_iface);
err:
batadv_hardif_free_ref(hard_iface);
--
1.8.1.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-24 18:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-24 12:00 [B.A.T.M.A.N.] [PATCH maint] batman-adv: fix interface clean up on error Antonio Quartulli
2013-03-24 18:30 ` Antonio Quartulli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox