]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Staging: batman-adv: Create batman_if only on register event
authorSven Eckelmann <sven.eckelmann@gmx.de>
Sat, 21 Aug 2010 12:18:08 +0000 (14:18 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 26 Aug 2010 23:46:22 +0000 (16:46 -0700)
commit 1189f130f89b73eecb6117c0fc5e90abbcb7faa0 upstream.

We try to get all events for all net_devices to be able to add special
sysfs folders for the batman-adv configuration. This also includes such
events like NETDEV_POST_INIT which has no valid kobject according to
v2.6.32-rc3-13-g7ffbe3f. This would create an oops in that situation.

It is enough to create the batman_if only on NETDEV_REGISTER events
because we will also receive those events for devices which already
existed when we registered the notifier call.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/batman-adv/hard-interface.c

index 7a582e80de188bccaea0e8a8e051a850a6ba409a..92997327ae9f845fc80e8534e8390080cfa58002 100644 (file)
@@ -397,15 +397,13 @@ static int hard_if_event(struct notifier_block *this,
        /* FIXME: each batman_if will be attached to a softif */
        struct bat_priv *bat_priv = netdev_priv(soft_device);
 
-       if (!batman_if)
-               batman_if = hardif_add_interface(net_dev);
+       if (!batman_if && event == NETDEV_REGISTER)
+                       batman_if = hardif_add_interface(net_dev);
 
        if (!batman_if)
                goto out;
 
        switch (event) {
-       case NETDEV_REGISTER:
-               break;
        case NETDEV_UP:
                hardif_activate_interface(bat_priv, batman_if);
                break;