diff options
Diffstat (limited to 'net/wireless/nl80211.c')
| -rw-r--r-- | net/wireless/nl80211.c | 26 | 
1 files changed, 15 insertions, 11 deletions
| diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 112b4bb009c8..4f63059efd81 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -462,6 +462,11 @@ nl80211_sta_wme_policy[NL80211_STA_WME_MAX + 1] = {  	[NL80211_STA_WME_MAX_SP] = { .type = NLA_U8 },  }; +static struct netlink_range_validation nl80211_punct_bitmap_range = { +	.min = 0, +	.max = 0xffff, +}; +  static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {  	[0] = { .strict_start_type = NL80211_ATTR_HE_OBSS_PD },  	[NL80211_ATTR_WIPHY] = { .type = NLA_U32 }, @@ -805,7 +810,8 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {  	[NL80211_ATTR_MLD_ADDR] = NLA_POLICY_EXACT_LEN(ETH_ALEN),  	[NL80211_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG },  	[NL80211_ATTR_MAX_NUM_AKM_SUITES] = { .type = NLA_REJECT }, -	[NL80211_ATTR_PUNCT_BITMAP] = NLA_POLICY_RANGE(NLA_U8, 0, 0xffff), +	[NL80211_ATTR_PUNCT_BITMAP] = +		NLA_POLICY_FULL_RANGE(NLA_U32, &nl80211_punct_bitmap_range),  };  /* policy for the key attributes */ @@ -8901,7 +8907,7 @@ static bool cfg80211_off_channel_oper_allowed(struct wireless_dev *wdev,  		struct cfg80211_chan_def *chandef;  		chandef = wdev_chandef(wdev, link_id); -		if (!chandef) +		if (!chandef || !chandef->chan)  			continue;  		/* @@ -10793,8 +10799,7 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,  static struct cfg80211_bss *nl80211_assoc_bss(struct cfg80211_registered_device *rdev,  					      const u8 *ssid, int ssid_len, -					      struct nlattr **attrs, -					      const u8 **bssid_out) +					      struct nlattr **attrs)  {  	struct ieee80211_channel *chan;  	struct cfg80211_bss *bss; @@ -10821,7 +10826,6 @@ static struct cfg80211_bss *nl80211_assoc_bss(struct cfg80211_registered_device  	if (!bss)  		return ERR_PTR(-ENOENT); -	*bssid_out = bssid;  	return bss;  } @@ -10831,7 +10835,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)  	struct net_device *dev = info->user_ptr[1];  	struct cfg80211_assoc_request req = {};  	struct nlattr **attrs = NULL; -	const u8 *bssid, *ssid; +	const u8 *ap_addr, *ssid;  	unsigned int link_id;  	int err, ssid_len; @@ -10968,6 +10972,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)  			return -EINVAL;  		req.ap_mld_addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]); +		ap_addr = req.ap_mld_addr;  		attrs = kzalloc(attrsize, GFP_KERNEL);  		if (!attrs) @@ -10993,8 +10998,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)  				goto free;  			}  			req.links[link_id].bss = -				nl80211_assoc_bss(rdev, ssid, ssid_len, attrs, -						  &bssid); +				nl80211_assoc_bss(rdev, ssid, ssid_len, attrs);  			if (IS_ERR(req.links[link_id].bss)) {  				err = PTR_ERR(req.links[link_id].bss);  				req.links[link_id].bss = NULL; @@ -11045,10 +11049,10 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)  		if (req.link_id >= 0)  			return -EINVAL; -		req.bss = nl80211_assoc_bss(rdev, ssid, ssid_len, info->attrs, -					    &bssid); +		req.bss = nl80211_assoc_bss(rdev, ssid, ssid_len, info->attrs);  		if (IS_ERR(req.bss))  			return PTR_ERR(req.bss); +		ap_addr = req.bss->bssid;  	}  	err = nl80211_crypto_settings(rdev, info, &req.crypto, 1); @@ -11061,7 +11065,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)  			dev->ieee80211_ptr->conn_owner_nlportid =  				info->snd_portid;  			memcpy(dev->ieee80211_ptr->disconnect_bssid, -			       bssid, ETH_ALEN); +			       ap_addr, ETH_ALEN);  		}  		wdev_unlock(dev->ieee80211_ptr); |