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