From patchwork Sat Aug 14 21:07:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 334 Return-Path: Received: from mail.gmx.net (mailout-de.gmx.net [213.165.64.23]) by open-mesh.net (Postfix) with SMTP id 73EF6154554 for ; Sat, 14 Aug 2010 23:08:08 +0200 (CEST) Received: (qmail invoked by alias); 14 Aug 2010 21:08:07 -0000 Received: from unknown (EHLO sven-desktop.lazhur.ath.cx) [89.246.199.18] by mail.gmx.net (mp011) with SMTP; 14 Aug 2010 23:08:07 +0200 X-Authenticated: #15668376 X-Provags-ID: V01U2FsdGVkX19obl1iQpZonskEh8Tp6i/zn12TZ4UbKBodg4H0z9 51fzN9H2wqBFF5 From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Sat, 14 Aug 2010 23:07:57 +0200 Message-Id: <1281820085-13507-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 1/9] batman-adv: Create batman_if only on register event 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 21:08:08 -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. 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 Cc: stable --- batman-adv/hard-interface.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/batman-adv/hard-interface.c b/batman-adv/hard-interface.c index 1a829be..f481cbb 100644 --- a/batman-adv/hard-interface.c +++ b/batman-adv/hard-interface.c @@ -457,15 +457,13 @@ 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 && 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(batman_if); break;