linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211:  Fix deadlock in ieee80211_do_stop.
@ 2010-11-12 20:07 greearb
  2010-11-12 20:08 ` Luis R. Rodriguez
  2010-11-12 20:49 ` Johannes Berg
  0 siblings, 2 replies; 41+ messages in thread
From: greearb @ 2010-11-12 20:07 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ben Greear

From: Ben Greear <greearb@candelatech.com>

We cannot call flush_work here because we are holding
RTNL and the worker thread(s) that will be called upon to
do the flushing might already be running a piece of work
that is blocking on RTNL.  That leads to deadlock and/or
OOM.

The ieee80211_iface_work method does nothing when sdata
is stopped (as it would be when the flush_work was called)
so it shouldn't be any big change to just cancel the work
entirely.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 7aa8559... 073b42a... M	net/mac80211/iface.c
 net/mac80211/iface.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 7aa8559..073b42a 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -516,7 +516,13 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
 		}
 		/* fall through */
 	default:
-		flush_work(&sdata->work);
+		/* Cannot call flush_work here because we are holding
+		 * RTNL and the worker thread(s) that will be called upon to
+		 * do the flushing might already be running a piece of work
+		 * that is blocking on RTNL.  That leads to deadlock and/or
+		 * OOM.
+		 */
+		cancel_work_sync(&sdata->work);
 		/*
 		 * When we get here, the interface is marked down.
 		 * Call synchronize_rcu() to wait for the RX path
-- 
1.7.2.3


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

end of thread, other threads:[~2010-12-10 16:35 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-12 20:07 [PATCH] mac80211: Fix deadlock in ieee80211_do_stop greearb
2010-11-12 20:08 ` Luis R. Rodriguez
2010-11-12 20:16   ` Ben Greear
2010-11-12 20:49 ` Johannes Berg
2010-11-12 20:57   ` Ben Greear
2010-11-12 21:08     ` Johannes Berg
2010-11-12 21:51       ` Ben Greear
2010-11-13 10:34       ` Tejun Heo
2010-11-15 21:16         ` Ben Greear
2010-11-16 14:19           ` Tejun Heo
2010-11-16 16:51             ` Ben Greear
2010-11-17  8:55               ` Tejun Heo
2010-11-17 17:37                 ` Ben Greear
2010-11-16 17:40             ` Johannes Berg
2010-11-17  8:47               ` Tejun Heo
2010-11-17 18:53                 ` Johannes Berg
2010-11-17 18:59                   ` Ben Greear
2010-11-17 19:03                     ` Johannes Berg
2010-11-18  6:34                   ` Tejun Heo
2010-11-18  7:07                     ` Johannes Berg
2010-11-18  7:22                       ` Tejun Heo
2010-11-18 16:59                         ` Johannes Berg
2010-11-19 14:34                           ` Tejun Heo
2010-11-19 17:57                             ` Johannes Berg
2010-11-19 20:55                               ` Ben Greear
2010-11-19 22:27                                 ` Luis R. Rodriguez
2010-12-08 17:36                                   ` Ben Greear
2010-12-08 18:19                                     ` Ben Greear
2010-12-08 18:28                                       ` Ben Greear
2010-12-09 14:34                                         ` Tejun Heo
2010-12-09 14:42                                           ` Johannes Berg
2010-12-09 14:46                                             ` Tejun Heo
2010-12-09 16:17                                               ` Tejun Heo
     [not found]                                                 ` <4D0156F6.4000306@candelate ch.com>
2010-12-09 17:27                                                 ` Ben Greear
2010-12-09 22:23                                                 ` Ben Greear
2010-12-10 15:11                                                   ` Tejun Heo
2010-12-10 16:35                                                     ` Ben Greear
2010-11-18 17:55                         ` Ben Greear
2010-11-18 18:04                           ` Tejun Heo
2010-11-18 18:11                             ` Ben Greear
2010-11-17 20:13             ` Ben Greear

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