From patchwork Sat Aug 14 17:06:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 299 Return-Path: Received: from mail.gmx.net (mailout-de.gmx.net [213.165.64.22]) by open-mesh.net (Postfix) with SMTP id 6E15315453E for ; Sat, 14 Aug 2010 19:06:50 +0200 (CEST) Received: (qmail invoked by alias); 14 Aug 2010 17:06:49 -0000 Received: from unknown (EHLO sven-desktop.lazhur.ath.cx) [89.246.199.18] by mail.gmx.net (mp026) with SMTP; 14 Aug 2010 19:06:49 +0200 X-Authenticated: #15668376 X-Provags-ID: V01U2FsdGVkX19ii+0P3FFi18KojyjgxiPHKK6dWZVrlqgb/a+6K5 I5xTm4UxIXsfIs From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Sat, 14 Aug 2010 19:06:47 +0200 Message-Id: <1281805607-7494-1-git-send-email-sven.eckelmann@gmx.de> X-Mailer: git-send-email 1.7.1 X-Y-GMX-Trusted: 0 Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: Create batman_if only on special events X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Aug 2010 17:06:50 -0000 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. We also drop NETDEV_UNREGISTER as event which may register a new batman_if because it would be destroyed after its initialisation. Signed-off-by: Sven Eckelmann Cc: stable --- batman-adv/hard-interface.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/batman-adv/hard-interface.c b/batman-adv/hard-interface.c index 1a829be..09678a6 100644 --- a/batman-adv/hard-interface.c +++ b/batman-adv/hard-interface.c @@ -457,15 +457,24 @@ static int hard_if_event(struct notifier_block *this, struct batman_if *batman_if = get_batman_if_by_netdev(net_dev); struct bat_priv *bat_priv; - if (!batman_if) - batman_if = hardif_add_interface(net_dev); + if (!batman_if) { + switch (event) { + case NETDEV_REGISTER: + case NETDEV_UP: + case NETDEV_GOING_DOWN: + case NETDEV_DOWN: + case NETDEV_CHANGENAME: + case NETDEV_CHANGEADDR: + batman_if = hardif_add_interface(net_dev); + default: + break; + } + } if (!batman_if) goto out; switch (event) { - case NETDEV_REGISTER: - break; case NETDEV_UP: hardif_activate_interface(batman_if); break; @@ -476,8 +485,6 @@ static int hard_if_event(struct notifier_block *this, case NETDEV_UNREGISTER: hardif_remove_interface(batman_if); break; - case NETDEV_CHANGENAME: - break; case NETDEV_CHANGEADDR: if (batman_if->if_status == IF_NOT_IN_USE) goto out;