From: Johannes Berg Date: Wed, 27 May 2009 08:35:29 +0000 (+0200) Subject: cfg80211: disallow interfering with stations on non-AP (part 2) X-Git-Tag: v3.0~8655^2~234^2~49 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=034d655ee7b79a2f48ba4c2b620d2864a6e0aa14;p=platform%2Fkernel%2Flinux-amlogic.git cfg80211: disallow interfering with stations on non-AP (part 2) 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. (Reconcile this w/ previous version of patch posted with same subject... -- JWL) Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 909ebd6..fd392ff 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -1687,6 +1687,12 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) 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, ¶ms.vlan); if (err) goto out;