diff options
author | Antonio Quartulli <ordex@autistici.org> | 2013-04-19 05:04:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-22 20:40:48 -0400 |
commit | 0c501345ce24983d234fc913e7e81b6abe59cb54 (patch) | |
tree | c08635c7a029036a7bf71f79a11c1a21e5b6204c /net/batman-adv | |
parent | 6e0895c2ea326cc4bb11e8fa2f654628d5754c31 (diff) |
batman-adv: fix global protection fault during soft_iface destruction
batadv_mesh_free() schedules some RCU callbacks which need the bat_priv struct
to do their jobs, while free_netdev(), which is called immediately after, is
destroying the private data.
Put an rcu_barrier() in the middle so that free_netdev() is invoked only after
all the callbacks returned.
This bug has been introduced by ab8f433dd39be94e8617cff2dfe9f7eca162eb15
("batman-adv: Move deinitialization of soft-interface to destructor")
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/batman-adv')
-rw-r--r-- | net/batman-adv/soft-interface.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 403b8c46085e..6f20d339e33a 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -582,6 +582,13 @@ static void batadv_softif_free(struct net_device *dev) | |||
582 | { | 582 | { |
583 | batadv_debugfs_del_meshif(dev); | 583 | batadv_debugfs_del_meshif(dev); |
584 | batadv_mesh_free(dev); | 584 | batadv_mesh_free(dev); |
585 | |||
586 | /* some scheduled RCU callbacks need the bat_priv struct to accomplish | ||
587 | * their tasks. Wait for them all to be finished before freeing the | ||
588 | * netdev and its private data (bat_priv) | ||
589 | */ | ||
590 | rcu_barrier(); | ||
591 | |||
585 | free_netdev(dev); | 592 | free_netdev(dev); |
586 | } | 593 | } |
587 | 594 | ||