Skip to contentSkip to conversation

mac80211: mesh: fix mesh_id check

PATCH In review Johannes Berg 3 participants 5 messages Jan 21, 2014 – Jan 22, 2014 mac80211

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 mac80211: mesh: fix mesh_id check

From: Johannes Berg <[email protected]>

The mesh_id is an array so can't ever be NULL, it looks like mesh_id_len check was intended instead.

---
 net/mac80211/cfg.c  | 2 +-
 net/mac80211/mesh.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
net/mac80211/cfg.c +1 -1
index db17c9c..cd14bef 100644
@@ -3108,7 +3108,7 @@ static int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
 	case NL80211_IFTYPE_MESH_POINT:
 		ifmsh = &sdata->u.mesh;
 
-		if (!ifmsh->mesh_id)
+		if (!ifmsh->mesh_id_len)
 			return -EINVAL;
 
 		if (params->chandef.width != sdata->vif.bss_conf.chandef.width)
net/mac80211/mesh.c +1 -1
index ba10525..59f6243 100644
@@ -866,7 +866,7 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
 	if (sdata->vif.csa_active)
 		return true;
 
-	if (!ifmsh->mesh_id)
+	if (!ifmsh->mesh_id_len)
 		return false;
 
 	sta_flags = IEEE80211_STA_DISABLE_VHT;
Signature · 1 line
1.8.5.1
#1 lore raw

Hi, Johannes

Thanks for pointing out.

net/mac80211/mesh.c ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata, · line 869

Quoted 6 lines
net/mac80211/mesh.c +1 -1
@@ -866,7 +866,7 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
        if (sdata->vif.csa_active)
                return true;
 
-       if (!ifmsh->mesh_id)
+       if (!ifmsh->mesh_id_len)

I don't see this in mac80211-next. Anyway, I think that this is not needed since the checking (sdata->wdev.mesh_id_len) is done at ieee80211_mesh_rx_queued_mgmt prior to ieee80211_mesh_process_chnswitch.

---
Chun-Yeow

author maintainer
#2 lore raw
Quoted 11 lines · Chun-Yeow Yeoh

net/mac80211/mesh.c ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata, · line 869

Quoted 6 lines
net/mac80211/mesh.c +1 -1
@@ -866,7 +866,7 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
        if (sdata->vif.csa_active)
                return true;
 
-       if (!ifmsh->mesh_id)
+       if (!ifmsh->mesh_id_len)

I don't see this in mac80211-next. Anyway, I think that this is not needed since the checking (sdata->wdev.mesh_id_len) is done at ieee80211_mesh_rx_queued_mgmt prior to ieee80211_mesh_process_chnswitch.

Indeed, this part seems to only be in 3.13 - probably got cleaned up in somebody else's patches. I think though mac80211 should probably check ifmsh->mesh_id_len and not sdata->wdev.mesh_id_len? Also, cfg80211 seems to be missing this check in nl80211_channel_switch(), no?

johannes

#3 lore raw
Quoted 3 lines

Indeed, this part seems to only be in 3.13 - probably got cleaned up in somebody else's patches. I think though mac80211 should probably check ifmsh->mesh_id_len and not sdata->wdev.mesh_id_len?

Agreed.

Quoted 1 line

Also, cfg80211 seems to be missing this check in nl80211_channel_switch(), no?

This checking is required for FullMAC implementation, right?

---
Chun-Yeow

author maintainer
#4 lore raw
Quoted 2 lines · Yeoh Chun-Yeow
Quoted 1 line

Also, cfg80211 seems to be missing this check in nl80211_channel_switch(), no?

This checking is required for FullMAC implementation, right?

Which is unlikely to support it, but generally it seems better to do it closer to userspace. I've posted a patch for it.

johannes