Skip to contentSkip to conversation

cfg80211: disallow interfering with stations on non-AP

PATCH Superseded Johannes Berg 1 participant 3 messages May 11, 2009 – May 27, 2009 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 cfg80211: disallow interfering with stations on non-AP

On non-AP interfaces userspace has no business interfering with the station management, this can confuse mac80211 (and other drivers probably wouldn't support it anyway). Allow adding and removing stations only on AP interfaces.

---
 net/wireless/nl80211.c |    8 ++++++++
 1 file changed, 8 insertions(+)
net/wireless/nl80211.c +8 -0
@@ -1726,6 +1726,10 @@ static int nl80211_new_station(struct sk
 	if (err)
 		goto out_rtnl;
 
+	if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
+	    dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN)
+		return -EINVAL;
+
 	err = get_vlan(info->attrs[NL80211_ATTR_STA_VLAN], drv, &params.vlan);
 	if (err)
 		goto out;
@@ -1769,6 +1773,10 @@ static int nl80211_del_station(struct sk
 	if (err)
 		goto out_rtnl;
 
+	if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
+	    dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN)
+		return -EINVAL;
+
 	if (!drv->ops->del_station) {
 		err = -EOPNOTSUPP;
 		goto out;
author maintainer
#1 lore raw

PATCH v2 1/1 cfg80211: disallow interfering with stations on non-AP

On non-AP interfaces userspace has no business interfering with the station management, this can confuse mac80211 (and other drivers probably wouldn't support it anyway). Allow adding and removing stations only on AP interfaces.

---
Oops.

 net/wireless/nl80211.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
net/wireless/nl80211.c +12 -0
@@ -1726,6 +1726,12 @@ static int nl80211_new_station(struct sk
 	if (err)
 		goto out_rtnl;
 
+	if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
+	    dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN) {
+		err = -EINVAL;
+		goto out;
+	}
+
 	err = get_vlan(info->attrs[NL80211_ATTR_STA_VLAN], drv, &params.vlan);
 	if (err)
 		goto out;
@@ -1769,6 +1775,12 @@ static int nl80211_del_station(struct sk
 	if (err)
 		goto out_rtnl;
 
+	if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
+	    dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN) {
+		err = -EINVAL;
+		goto out;
+	}
+
 	if (!drv->ops->del_station) {
 		err = -EOPNOTSUPP;
 		goto out;
author maintainer
#2 lore raw

PATCH RESEND v2 1/1 cfg80211: disallow interfering with stations on non-AP

On non-AP interfaces userspace has no business interfering with the station management, this can confuse mac80211 (and other drivers probably wouldn't support it anyway). Allow adding and removing stations only on AP interfaces.

---
 net/wireless/nl80211.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
net/wireless/nl80211.c +12 -0
@@ -1687,6 +1687,12 @@ static int nl80211_set_station(struct sk
 	if (err)
 		goto out_rtnl;
 
+	if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
+	    dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN) {
+		err = -EINVAL;
+		goto out;
+	}
+
 	err = get_vlan(info->attrs[NL80211_ATTR_STA_VLAN], drv, &params.vlan);
 	if (err)
 		goto out;
@@ -1811,6 +1817,12 @@ static int nl80211_del_station(struct sk
 		goto out;
 	}
 
+	if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
+	    dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN) {
+		err = -EINVAL;
+		goto out;
+	}
+
 	if (!drv->ops->del_station) {
 		err = -EOPNOTSUPP;
 		goto out;