From patchwork Sun Oct 31 21:07:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Linus_L=C3=BCssing?= X-Patchwork-Id: 515 Return-Path: Received: from fmmailgate02.web.de (fmmailgate02.web.de [217.72.192.227]) by open-mesh.org (Postfix) with ESMTP id E4A731544AE for ; Sun, 31 Oct 2010 22:07:39 +0100 (CET) Received: from smtp04.web.de ( [172.20.0.225]) by fmmailgate02.web.de (Postfix) with ESMTP id 681B317CDF9B9 for ; Sun, 31 Oct 2010 22:07:39 +0100 (CET) Received: from [46.126.246.98] (helo=localhost) by smtp04.web.de with asmtp (TLSv1:AES128-SHA:128) (WEB.DE 4.110 #4) id 1PCf7q-0002RO-00; Sun, 31 Oct 2010 22:07:39 +0100 From: =?UTF-8?q?Linus=20L=C3=BCssing?= To: b.a.t.m.a.n@lists.open-mesh.org Date: Sun, 31 Oct 2010 22:07:37 +0100 Message-Id: <1288559257-30844-1-git-send-email-linus.luessing@web.de> X-Mailer: git-send-email 1.7.1 In-Reply-To: <201010311712.07786.sven.eckelmann@gmx.de> References: <201010311712.07786.sven.eckelmann@gmx.de> MIME-Version: 1.0 Sender: linus.luessing@web.de X-Sender: linus.luessing@web.de X-Provags-ID: V01U2FsdGVkX186zfnNeCYWoAgFMuNz9s3Wjzk6wCN0xKce0Seh LQxa3QBO8m5+erHnOUDhblvCaPBHqnBVI7gKJ9HU+bmJ80DLh1 C63FqoU6eRj8LIzsT7KQ== Subject: [B.A.T.M.A.N.] [PATCHv2] batman-adv: Don't call sysfs_del_hardif() in atomic context 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: Sun, 31 Oct 2010 21:07:40 -0000 sysfs_del_hardif invokes kobject_put, which might sleep. However, we are not allowed to sleep during a call_rcu. There is also no need to do the removal with an atomic call_rcu, as kobject_put only frees the kobject when there is no more reference to it anyway. Signed-off-by: Linus Lüssing --- hard-interface.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hard-interface.c b/hard-interface.c index 37f0f8b..a9b8367 100644 --- a/hard-interface.c +++ b/hard-interface.c @@ -41,7 +41,6 @@ static void hardif_free_rcu(struct rcu_head *rcu) struct batman_if *batman_if; batman_if = container_of(rcu, struct batman_if, rcu); - sysfs_del_hardif(&batman_if->hardif_obj); dev_put(batman_if->net_dev); kref_put(&batman_if->refcount, hardif_free_ref); } @@ -470,6 +469,7 @@ static void hardif_remove_interface(struct batman_if *batman_if) /* caller must take if_list_lock */ list_del_rcu(&batman_if->list); + sysfs_del_hardif(&batman_if->hardif_obj); call_rcu(&batman_if->rcu, hardif_free_rcu); }