Skip to content

Commit

Permalink
Staging: batman-adv: Always synchronize rcu's on module shutdown
Browse files Browse the repository at this point in the history
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 <linus.luessing@web.de>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Linus Lüssing authored and Greg Kroah-Hartman committed Sep 14, 2010
1 parent 6267ea6 commit 09686b5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/staging/batman-adv/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,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)
Expand Down Expand Up @@ -132,9 +134,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);
}

Expand Down

0 comments on commit 09686b5

Please sign in to comment.