From patchwork Mon Sep 6 12:45:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 388 Return-Path: Received: from mail.gmx.net (mailout-de.gmx.net [213.165.64.23]) by open-mesh.net (Postfix) with SMTP id 0F5481540C2 for ; Mon, 6 Sep 2010 14:45:15 +0200 (CEST) Received: (qmail invoked by alias); 06 Sep 2010 12:45:13 -0000 Received: from i59F6A5DA.versanet.de (EHLO sven-desktop.lazhur.ath.cx) [89.246.165.218] by mail.gmx.net (mp053) with SMTP; 06 Sep 2010 14:45:13 +0200 X-Authenticated: #15668376 X-Provags-ID: V01U2FsdGVkX1+mYBM2zIymXJji/B8Y3+gCZYIRCj6x26bxsvemMM QSDReOpmaDGhrQ From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Mon, 6 Sep 2010 14:45:24 +0200 Message-Id: <1283777124-26316-1-git-send-email-sven.eckelmann@gmx.de> X-Mailer: git-send-email 1.7.1 In-Reply-To: <20100906123745.GB13669@Sellars> References: <20100906123745.GB13669@Sellars> MIME-Version: 1.0 X-Y-GMX-Trusted: 0 Subject: [B.A.T.M.A.N.] [PATCHv2] batman-adv: Always synchronize rcu's on module shutdown 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: Mon, 06 Sep 2010 12:45:15 -0000 From: Linus Lüssing During the module shutdown procedure in batman_exit(), a rcu callback is being scheduled (batman_exit -> hardif_remove_interfaces -> hardif_remove_interfae -> call_rcu). However, when the kernel unloads the module, the rcu callback might not have been executed yet, resulting in a "unable to handle kernel paging request" in __rcu_process_callback afterwards, causing the kernel to freeze. The synchronize_net and synchronize_rcu in mesh_free are currently called before the call_rcu in hardif_remove_interface and have no real effect on it. Therefore, we should always flush all rcu callback functions scheduled during the shutdown procedure using synchronize_net. The call to synchronize_rcu can be omitted because synchronize_net already calls it. Signed-off-by: Linus Lüssing Acked-by: Sven Eckelmann --- batman-adv/main.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/batman-adv/main.c b/batman-adv/main.c index 209a46b..e8acb46 100644 --- a/batman-adv/main.c +++ b/batman-adv/main.c @@ -73,6 +73,8 @@ static void __exit batman_exit(void) flush_workqueue(bat_event_workqueue); destroy_workqueue(bat_event_workqueue); bat_event_workqueue = NULL; + + synchronize_net(); } int mesh_init(struct net_device *soft_iface) @@ -135,9 +137,6 @@ void mesh_free(struct net_device *soft_iface) hna_local_free(bat_priv); hna_global_free(bat_priv); - synchronize_net(); - - synchronize_rcu(); atomic_set(&bat_priv->mesh_state, MESH_INACTIVE); }