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);
On Sun, Mar 24, 2013 at 01:00:31 +0100, Antonio Quartulli wrote:
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
I forgot to mention that this problem was already observed in the past during previous tests of the rtnl API:
Reported-by: Marek Lindner lindner_marek@yahoo.de
Thanks!
Signed-off-by: Antonio Quartulli ordex@autistici.org
b.a.t.m.a.n@lists.open-mesh.org