1 From 3bb2899bd37b1bb127adaa6808f4b1fa716df0de Mon Sep 17 00:00:00 2001
2 From: Sven Eckelmann <sven.eckelmann@gmx.de>
3 Date: Fri, 20 Aug 2010 19:16:00 +0000
4 Subject: [PATCH 08/10] batman-adv: Create batman_if only on register event
6 We try to get all events for all net_devices to be able to add special
7 sysfs folders for the batman-adv configuration. This also includes such
8 events like NETDEV_POST_INIT which has no valid kobject according to
9 v2.6.32-rc3-13-g7ffbe3f. This would create an oops in that situation.
11 It is enough to create the batman_if only on NETDEV_REGISTER events
12 because we will also receive those events for devices which already
13 existed when we registered the notifier call.
15 Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
16 Cc: stable <stable@kernel.org>
18 hard-interface.c | 6 ++----
19 1 files changed, 2 insertions(+), 4 deletions(-)
21 diff --git a/hard-interface.c b/hard-interface.c
22 index e3e1e9e..1670ec8 100644
23 --- a/hard-interface.c
24 +++ b/hard-interface.c
25 @@ -395,15 +395,13 @@ static int hard_if_event(struct notifier_block *this,
26 /* FIXME: each batman_if will be attached to a softif */
27 struct bat_priv *bat_priv = netdev_priv(soft_device);
30 - batman_if = hardif_add_interface(net_dev);
31 + if (!batman_if && event == NETDEV_REGISTER)
32 + batman_if = hardif_add_interface(net_dev);
38 - case NETDEV_REGISTER:
41 hardif_activate_interface(soft_device, bat_priv, batman_if);