2014-01-21 20:05:06

by Johannes Berg

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Johannes Berg <[email protected]>
---
net/mac80211/cfg.c | 2 +-
net/mac80211/mesh.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index db17c9c..cd14bef 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -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)
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index ba10525..59f6243 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -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;
--
1.8.5.1




2014-01-22 10:09:28

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] mac80211: mesh: fix mesh_id check

On Wed, 2014-01-22 at 17:59 +0800, Yeoh Chun-Yeow wrote:

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


2014-01-22 06:45:35

by Chun-Yeow Yeoh

[permalink] [raw]
Subject: Re: [PATCH] mac80211: mesh: fix mesh_id check

Hi, Johannes

Thanks for pointing out.

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

2014-01-22 08:21:51

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] mac80211: mesh: fix mesh_id check

On Wed, 2014-01-22 at 14:45 +0800, Chun-Yeow Yeoh wrote:

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


2014-01-22 09:59:25

by Chun-Yeow Yeoh

[permalink] [raw]
Subject: Re: [PATCH] mac80211: mesh: fix mesh_id check

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

> Also, cfg80211 seems to be missing this check in nl80211_channel_switch(), no?
This checking is required for FullMAC implementation, right?

---
Chun-Yeow