b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH next] batman-adv: fix global protection fault during soft_iface destruction
@ 2013-04-17 19:45 Antonio Quartulli
  2013-04-17 19:56 ` Marek Lindner
  0 siblings, 1 reply; 2+ messages in thread
From: Antonio Quartulli @ 2013-04-17 19:45 UTC (permalink / raw)
  To: b.a.t.m.a.n

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>
---


 soft-interface.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/soft-interface.c b/soft-interface.c
index 403b8c4..6f20d33 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -582,6 +582,13 @@ static void batadv_softif_free(struct net_device *dev)
 {
 	batadv_debugfs_del_meshif(dev);
 	batadv_mesh_free(dev);
+
+	/* some scheduled RCU callbacks need the bat_priv struct to accomplish
+	 * their tasks. Wait for them all to be finished before freeing the
+	 * netdev and its private data (bat_priv)
+	 */
+	rcu_barrier();
+
 	free_netdev(dev);
 }
 
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH next] batman-adv: fix global protection fault during soft_iface destruction
  2013-04-17 19:45 [B.A.T.M.A.N.] [PATCH next] batman-adv: fix global protection fault during soft_iface destruction Antonio Quartulli
@ 2013-04-17 19:56 ` Marek Lindner
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Lindner @ 2013-04-17 19:56 UTC (permalink / raw)
  To: b.a.t.m.a.n

On Thursday, April 18, 2013 03:45:43 Antonio Quartulli wrote:
> 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>
> ---
> 
> 
>  soft-interface.c | 7 +++++++
>  1 file changed, 7 insertions(+)

Applied in revision 73eb82e.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-17 19:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-17 19:45 [B.A.T.M.A.N.] [PATCH next] batman-adv: fix global protection fault during soft_iface destruction Antonio Quartulli
2013-04-17 19:56 ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).