diff mbox

mac80211: Fix deadlock in ieee80211_do_stop.

Message ID 1289592426-5367-1-git-send-email-greearb@candelatech.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Ben Greear Nov. 12, 2010, 8:07 p.m. UTC
None
diff mbox

Patch

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