diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index 5fc240259f55c8e85b42038edbc4ae6e47b1f327..00df2a9a26616962eded6a43702b87bce077fe55 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c @@ -493,7 +493,16 @@ static void ieee80211_if_shutdown(struct net_device *dev) case IEEE80211_IF_TYPE_IBSS: sdata->u.sta.state = IEEE80211_DISABLED; del_timer_sync(&sdata->u.sta.timer); + /* + * Holding the sub_if_lock for writing here blocks + * out the receive path and makes sure it's not + * currently processing a packet that may get + * added to the queue. + */ + write_lock_bh(&local->sub_if_lock); skb_queue_purge(&sdata->u.sta.skb_queue); + write_unlock_bh(&local->sub_if_lock); + if (!local->ops->hw_scan && local->scan_dev == sdata->dev) { local->sta_scanning = 0; diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 95a00eb572499142492c4be38883cc5dbfb72710..01176ba52df467e96eea055af4d7b344325b0eb5 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -1380,6 +1380,9 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, list_for_each_entry(sdata, &local->sub_if_list, list) { rx.u.rx.ra_match = 1; + if (!netif_running(sdata->dev)) + continue; + prepres = prepare_for_handlers(sdata, bssid, &rx, hdr); /* prepare_for_handlers can change sta */ sta = rx.sta;