[v2] batman-adv: Don't call sysfs_del_hardif() in atomic context
Commit Message
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(-)
Comments
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
@@ -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);
}