Message ID | 1288559257-30844-1-git-send-email-linus.luessing@web.de |
---|---|
State | Accepted, archived |
Commit | 31162e763f614f0559670751188e1f967f093cbe |
Headers | show |
On Sunday 31 October 2010 22:07:37 Linus Lüssing wrote: > 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. Applied in revision 1856. Thanks, Marek
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); }
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 <linus.luessing@web.de> --- hard-interface.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)