diff options
| author | Manikanta Pubbisetty <mpubbise@codeaurora.org> | 2019-07-22 12:44:50 +0530 | 
|---|---|---|
| committer | Johannes Berg <johannes.berg@intel.com> | 2019-07-26 13:50:43 +0200 | 
| commit | e6f4051123fd33901e9655a675b22aefcdc5d277 (patch) | |
| tree | 43c53eee6035e004f879f708191f9e04440c6443 /net/wireless | |
| parent | 47d858d0bdcd47cc1c6c9eeca91b091dd9e55637 (diff) | |
| download | linux-e6f4051123fd33901e9655a675b22aefcdc5d277.tar.bz2 | |
{nl,mac}80211: fix interface combinations on crypto controlled devices
Commit 33d915d9e8ce ("{nl,mac}80211: allow 4addr AP operation on
crypto controlled devices") has introduced a change which allows
4addr operation on crypto controlled devices (ex: ath10k). This
change has inadvertently impacted the interface combinations logic
on such devices.
General rule is that software interfaces like AP/VLAN should not be
listed under supported interface combinations and should not be
considered during validation of these combinations; because of the
aforementioned change, AP/VLAN interfaces(if present) will be checked
against interfaces supported by the device and blocks valid interface
combinations.
Consider a case where an AP and AP/VLAN are up and running; when a
second AP device is brought up on the same physical device, this AP
will be checked against the AP/VLAN interface (which will not be
part of supported interface combinations of the device) and blocks
second AP to come up.
Add a new API cfg80211_iftype_allowed() to fix the problem, this
API works for all devices with/without SW crypto control.
Signed-off-by: Manikanta Pubbisetty <mpubbise@codeaurora.org>
Fixes: 33d915d9e8ce ("{nl,mac}80211: allow 4addr AP operation on crypto controlled devices")
Link: https://lore.kernel.org/r/1563779690-9716-1-git-send-email-mpubbise@codeaurora.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
| -rw-r--r-- | net/wireless/core.c | 6 | ||||
| -rw-r--r-- | net/wireless/nl80211.c | 4 | ||||
| -rw-r--r-- | net/wireless/util.c | 27 | 
3 files changed, 28 insertions, 9 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index 45d9afcff6d5..32b3c719fdfc 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -1410,10 +1410,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,  		}  		break;  	case NETDEV_PRE_UP: -		if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)) && -		    !(wdev->iftype == NL80211_IFTYPE_AP_VLAN && -		      rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP && -		      wdev->use_4addr)) +		if (!cfg80211_iftype_allowed(wdev->wiphy, wdev->iftype, +					     wdev->use_4addr, 0))  			return notifier_from_errno(-EOPNOTSUPP);  		if (rfkill_blocked(rdev->rfkill)) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index fc83dd179c1a..fd05ae1437a9 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3484,9 +3484,7 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)  			return err;  	} -	if (!(rdev->wiphy.interface_modes & (1 << type)) && -	    !(type == NL80211_IFTYPE_AP_VLAN && params.use_4addr && -	      rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP)) +	if (!cfg80211_iftype_allowed(&rdev->wiphy, type, params.use_4addr, 0))  		return -EOPNOTSUPP;  	err = nl80211_parse_mon_options(rdev, type, info, ¶ms); diff --git a/net/wireless/util.c b/net/wireless/util.c index 1c39d6a2e850..d0e35b7b9e35 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -1697,7 +1697,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy,  	for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) {  		num_interfaces += params->iftype_num[iftype];  		if (params->iftype_num[iftype] > 0 && -		    !(wiphy->software_iftypes & BIT(iftype))) +		    !cfg80211_iftype_allowed(wiphy, iftype, 0, 1))  			used_iftypes |= BIT(iftype);  	} @@ -1719,7 +1719,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy,  			return -ENOMEM;  		for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) { -			if (wiphy->software_iftypes & BIT(iftype)) +			if (cfg80211_iftype_allowed(wiphy, iftype, 0, 1))  				continue;  			for (j = 0; j < c->n_limits; j++) {  				all_iftypes |= limits[j].types; @@ -2072,3 +2072,26 @@ int ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *cap,  	return max_vht_nss;  }  EXPORT_SYMBOL(ieee80211_get_vht_max_nss); + +bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype, +			     bool is_4addr, u8 check_swif) + +{ +	bool is_vlan = iftype == NL80211_IFTYPE_AP_VLAN; + +	switch (check_swif) { +	case 0: +		if (is_vlan && is_4addr) +			return wiphy->flags & WIPHY_FLAG_4ADDR_AP; +		return wiphy->interface_modes & BIT(iftype); +	case 1: +		if (!(wiphy->software_iftypes & BIT(iftype)) && is_vlan) +			return wiphy->flags & WIPHY_FLAG_4ADDR_AP; +		return wiphy->software_iftypes & BIT(iftype); +	default: +		break; +	} + +	return false; +} +EXPORT_SYMBOL(cfg80211_iftype_allowed);  |