Problem openWRT "backfire" and "kmod-batman-adv"
Commit Message
On Saturday 14 August 2010 19:26:56 Marek Lindner wrote:
> Could you please copy the attached patch into your batman-advanced patches
> folder and verify whether it fixes your problem ? This document explains
> the location of that folder and how to rebuild the package:
Here is the updated notify patch plus another patch which might solve the
issue. These are the patches posted by Sven but backported to 2000.0.0 and
prepared for OpenWRT. Please try the notify patch first and if it does not work
add the dev_hold patch and let us know how it goes.
Regards,
Marek
@@ -213,7 +213,6 @@ static void hardif_activate_interface(struct batman_if *batman_if)
if (batman_if->if_status != IF_INACTIVE)
return;
- dev_hold(batman_if->net_dev);
update_mac_addresses(batman_if);
batman_if->if_status = IF_TO_BE_ACTIVATED;
@@ -238,8 +237,6 @@ static void hardif_deactivate_interface(struct batman_if *batman_if)
(batman_if->if_status != IF_TO_BE_ACTIVATED))
return;
- dev_put(batman_if->net_dev);
-
batman_if->if_status = IF_INACTIVE;
bat_info(batman_if->soft_iface, "Interface deactivated: %s\n",
@@ -385,12 +382,14 @@ static struct batman_if *hardif_add_interface(struct net_device *net_dev)
if (ret != 1)
goto out;
+ dev_hold(net_dev);
+
batman_if = kmalloc(sizeof(struct batman_if), GFP_ATOMIC);
if (!batman_if) {
printk(KERN_ERR "batman-adv:"
"Can't add interface (%s): out of memory\n",
net_dev->name);
- goto out;
+ goto release_dev;
}
batman_if->dev = kstrdup(net_dev->name, GFP_ATOMIC);
@@ -408,6 +407,8 @@ static struct batman_if *hardif_add_interface(struct net_device *net_dev)
free_if:
kfree(batman_if);
+release_dev:
+ dev_put(net_dev);
out:
return NULL;
}
@@ -431,6 +432,7 @@ static void hardif_remove_interface(struct batman_if *batman_if)
batman_if->if_status = IF_TO_BE_REMOVED;
list_del_rcu(&batman_if->list);
sysfs_del_hardif(&batman_if->hardif_obj);
+ dev_put(batman_if->net_dev);
call_rcu(&batman_if->rcu, hardif_free_interface);
}