72cd837810a269a93919c8280bf2870e31074047
[openwrt/svn-archive/archive.git] / net / batman-advanced / patches / 0003-batman-adv-Create-batman_if-only-on-register-event.patch
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
5
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.
10
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.
14
15 Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
16 Cc: stable <stable@kernel.org>
17 ---
18 hard-interface.c | 6 ++----
19 1 files changed, 2 insertions(+), 4 deletions(-)
20
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);
28
29 - if (!batman_if)
30 - batman_if = hardif_add_interface(net_dev);
31 + if (!batman_if && event == NETDEV_REGISTER)
32 + batman_if = hardif_add_interface(net_dev);
33
34 if (!batman_if)
35 goto out;
36
37 switch (event) {
38 - case NETDEV_REGISTER:
39 - break;
40 case NETDEV_UP:
41 hardif_activate_interface(soft_device, bat_priv, batman_if);
42 break;
43 --
44 1.7.1
45