Skip to content

Commit

Permalink
Staging: batman-adv: Create batman_if only on register event
Browse files Browse the repository at this point in the history
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>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Sven Eckelmann authored and Greg Kroah-Hartman committed Aug 24, 2010
1 parent 51e21ae commit 1189f13
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/staging/batman-adv/hard-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,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(soft_device, bat_priv, batman_if);
break;
Expand Down

0 comments on commit 1189f13

Please sign in to comment.