Skip to contentSkip to conversation

[PATCH} mac80211: correction of IFTYPE_AP and IFTYPE_AP_VLAN in ieee80211_do_stop

PATCH wim torfs 2 participants 2 messages Jan 6, 2015 mac80211

lore
Share & tools
lore

wim torfs

author
#0 lore raw

While doing a code review, I noticed that in the latest stable version of the kernel (3.18.1) the functionality of IFTYPE_AP and IFTYPE_AP_VLAN is switched in ieee80211_do_stop. In the case of IEEE80211_IFTYPE_AP, the list of devices in sdata->u.ap.vlans are closed, while in the case of IEEE80211_IFTYPE_AP_VLAN the skbs in sdata->bss->ps->bc_buf are freed. I believe this should be the other way around.

I found that the error already existed since 3.9.13, but was not yet present in 3.2. I didn't check any versions between those.

The following patch corrects the above stated error. This correction has not been tested, it was discovered during a code review.

---

net/mac80211/iface.c +2 -2
diff -uprN linux-3.18.1.orig/net/mac80211/iface.c linux-3.18.1.patched/net/mac80211/iface.c
@@ -868,7 +868,7 @@ static void ieee80211_do_stop(struct iee
 	}
 
 	/* APs need special treatment */
-	if (sdata->vif.type == NL80211_IFTYPE_AP) {
+	if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
 		struct ieee80211_sub_if_data *vlan, *tmpsdata;
 
 		/* down all dependent devices, that is VLANs */
@@ -876,7 +876,7 @@ static void ieee80211_do_stop(struct iee
 					 u.vlan.list)
 			dev_close(vlan->dev);
 		WARN_ON(!list_empty(&sdata->u.ap.vlans));
-	} else if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
+	} else if (sdata->vif.type == NL80211_IFTYPE_AP) {
 		/* remove all packets in parent bc_buf pointing to this dev */
 		ps = &sdata->bss->ps;
 
maintainer
#1 lore raw
Quoted 6 lines · wim torfs

While doing a code review, I noticed that in the latest stable version of the kernel (3.18.1) the functionality of IFTYPE_AP and IFTYPE_AP_VLAN is switched in ieee80211_do_stop. In the case of IEEE80211_IFTYPE_AP, the list of devices in sdata->u.ap.vlans are closed, while in the case of IEEE80211_IFTYPE_AP_VLAN the skbs in sdata->bss->ps->bc_buf are freed. I believe this should be the other way around.

Well, you're wrong :)

johannes