|author||Antonio Quartulli <firstname.lastname@example.org>||2013-05-07 01:06:18 +0200|
|committer||Antonio Quartulli <email@example.com>||2013-05-09 12:39:45 +0200|
batman-adv: reorder clean up routine in order to avoid race conditions
nc_worker accesses the originator table during its periodic work, but since the originator table is freed before stopping the worker this leads to a global protection fault. Fix this by killing the worker (in nc_free) before freeing the originator table. Moreover tidy up the entire clean up routine by running all the subcomponents freeing procedures first and then killing the TT and the originator tables at the end. Signed-off-by: Antonio Quartulli <firstname.lastname@example.org> Signed-off-by: Marek Lindner <email@example.com>
Diffstat (limited to 'net')
1 files changed, 12 insertions, 4 deletions
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 9c620cd3b5f..1240f07ad31 100644
@@ -163,14 +163,22 @@ void batadv_mesh_free(struct net_device *soft_iface)
+ /* Free the TT and the originator tables only after having terminated
+ * all the other depending components which may use these structures for
+ * their purposes.
+ /* Since the originator table clean up routine is accessing the TT
+ * tables as well, it has to be invoked after the TT tables have been
+ * freed and marked as empty. This ensures that no cleanup RCU callbacks
+ * accessing the TT data are scheduled for later execution.