Skip to contentSkip to conversation

mac80211: don't send packets to interfaces that are down

PATCH In review Johannes Berg 1 participant 2 messages Aug 14, 2007 mac80211

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 mac80211: don't send packets to interfaces that are down

David Woodhouse noticed that under some circumstances the number of slab allocations kept growing. After looking a bit, this seemed to happen when you had a management mode interface that was *down*.

The reason for this is that when the device is down, all management frames get queued to the in-kernel MLME (via ieee80211_sta_rx_mgmt) but then the sta work is invoked but doesn't run when the netif is down. When you then bring the interface up, all such frames are freed, but if you change the mode all of them are lost because the skb queue is reinitialised as soon as you go back to managed mode. The skb queue is correctly cleared when the interface is brought down, but the code doesn't account for the fact that it may be filled while it is not up.

This patch should fix the issue by simply ignoring all interfaces that are down when going through the RX handlers.

---
Is there a possibility of a race condition here? If the interface is brought down right after this check the SKB could be copied to that interface after the skb queue has been flushed.

 net/mac80211/rx.c |    3 +++
 1 file changed, 3 insertions(+)
net/mac80211/rx.c +3 -0
@@ -1511,6 +1511,9 @@ void __ieee80211_rx(struct ieee80211_hw 
 	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;
author maintainer
#1 lore raw
Quoted 3 lines · Johannes Berg

Is there a possibility of a race condition here? If the interface is brought down right after this check the SKB could be copied to that interface after the skb queue has been flushed.

Oh once we sort that out this should go to all applicable kernels ASAP, including -stable I think (this is in stable right? :) )

johannes