Commit f86a677e authored by David S. Miller's avatar David S. Miller

Merge tag 'mac80211-for-davem-2019-07-31' of...

Merge tag 'mac80211-for-davem-2019-07-31' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211

Johannes Berg says:

====================
Just a few fixes:
 * revert NETIF_F_LLTX usage as it caused problems
 * avoid warning on WMM parameters from AP that are too short
 * fix possible null-ptr dereference in hwsim
 * fix interface combinations with 4-addr and crypto control
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents fa9586af eef347f8
...@@ -3617,10 +3617,12 @@ static int hwsim_dump_radio_nl(struct sk_buff *skb, ...@@ -3617,10 +3617,12 @@ static int hwsim_dump_radio_nl(struct sk_buff *skb,
hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, &hwsim_genl_family, cb->nlh->nlmsg_seq, &hwsim_genl_family,
NLM_F_MULTI, HWSIM_CMD_GET_RADIO); NLM_F_MULTI, HWSIM_CMD_GET_RADIO);
if (!hdr) if (hdr) {
res = -EMSGSIZE;
genl_dump_check_consistent(cb, hdr); genl_dump_check_consistent(cb, hdr);
genlmsg_end(skb, hdr); genlmsg_end(skb, hdr);
} else {
res = -EMSGSIZE;
}
} }
done: done:
......
...@@ -7320,6 +7320,21 @@ void cfg80211_pmsr_complete(struct wireless_dev *wdev, ...@@ -7320,6 +7320,21 @@ void cfg80211_pmsr_complete(struct wireless_dev *wdev,
struct cfg80211_pmsr_request *req, struct cfg80211_pmsr_request *req,
gfp_t gfp); gfp_t gfp);
/**
* cfg80211_iftype_allowed - check whether the interface can be allowed
* @wiphy: the wiphy
* @iftype: interface type
* @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
* @check_swif: check iftype against software interfaces
*
* Check whether the interface is allowed to operate; additionally, this API
* can be used to check iftype against the software interfaces when
* check_swif is '1'.
*/
bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
bool is_4addr, u8 check_swif);
/* Logging, debugging and troubleshooting/diagnostic helpers. */ /* Logging, debugging and troubleshooting/diagnostic helpers. */
/* wiphy_printk helpers, similar to dev_printk */ /* wiphy_printk helpers, similar to dev_printk */
......
...@@ -1222,7 +1222,6 @@ static void ieee80211_if_setup(struct net_device *dev) ...@@ -1222,7 +1222,6 @@ static void ieee80211_if_setup(struct net_device *dev)
static void ieee80211_if_setup_no_queue(struct net_device *dev) static void ieee80211_if_setup_no_queue(struct net_device *dev)
{ {
ieee80211_if_setup(dev); ieee80211_if_setup(dev);
dev->features |= NETIF_F_LLTX;
dev->priv_flags |= IFF_NO_QUEUE; dev->priv_flags |= IFF_NO_QUEUE;
} }
......
...@@ -2042,6 +2042,16 @@ ieee80211_sta_wmm_params(struct ieee80211_local *local, ...@@ -2042,6 +2042,16 @@ ieee80211_sta_wmm_params(struct ieee80211_local *local,
ieee80211_regulatory_limit_wmm_params(sdata, &params[ac], ac); ieee80211_regulatory_limit_wmm_params(sdata, &params[ac], ac);
} }
/* WMM specification requires all 4 ACIs. */
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
if (params[ac].cw_min == 0) {
sdata_info(sdata,
"AP has invalid WMM params (missing AC %d), using defaults\n",
ac);
return false;
}
}
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
mlme_dbg(sdata, mlme_dbg(sdata,
"WMM AC=%d acm=%d aifs=%d cWmin=%d cWmax=%d txop=%d uapsd=%d, downgraded=%d\n", "WMM AC=%d acm=%d aifs=%d cWmin=%d cWmax=%d txop=%d uapsd=%d, downgraded=%d\n",
......
...@@ -3796,9 +3796,7 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, ...@@ -3796,9 +3796,7 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
} }
/* Always allow software iftypes */ /* Always allow software iftypes */
if (local->hw.wiphy->software_iftypes & BIT(iftype) || if (cfg80211_iftype_allowed(local->hw.wiphy, iftype, 0, 1)) {
(iftype == NL80211_IFTYPE_AP_VLAN &&
local->hw.wiphy->flags & WIPHY_FLAG_4ADDR_AP)) {
if (radar_detect) if (radar_detect)
return -EINVAL; return -EINVAL;
return 0; return 0;
...@@ -3833,7 +3831,8 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, ...@@ -3833,7 +3831,8 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
if (sdata_iter == sdata || if (sdata_iter == sdata ||
!ieee80211_sdata_running(sdata_iter) || !ieee80211_sdata_running(sdata_iter) ||
local->hw.wiphy->software_iftypes & BIT(wdev_iter->iftype)) cfg80211_iftype_allowed(local->hw.wiphy,
wdev_iter->iftype, 0, 1))
continue; continue;
params.iftype_num[wdev_iter->iftype]++; params.iftype_num[wdev_iter->iftype]++;
......
...@@ -1410,10 +1410,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, ...@@ -1410,10 +1410,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
} }
break; break;
case NETDEV_PRE_UP: case NETDEV_PRE_UP:
if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)) && if (!cfg80211_iftype_allowed(wdev->wiphy, wdev->iftype,
!(wdev->iftype == NL80211_IFTYPE_AP_VLAN && wdev->use_4addr, 0))
rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP &&
wdev->use_4addr))
return notifier_from_errno(-EOPNOTSUPP); return notifier_from_errno(-EOPNOTSUPP);
if (rfkill_blocked(rdev->rfkill)) if (rfkill_blocked(rdev->rfkill))
......
...@@ -3484,9 +3484,7 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) ...@@ -3484,9 +3484,7 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
return err; return err;
} }
if (!(rdev->wiphy.interface_modes & (1 << type)) && if (!cfg80211_iftype_allowed(&rdev->wiphy, type, params.use_4addr, 0))
!(type == NL80211_IFTYPE_AP_VLAN && params.use_4addr &&
rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP))
return -EOPNOTSUPP; return -EOPNOTSUPP;
err = nl80211_parse_mon_options(rdev, type, info, &params); err = nl80211_parse_mon_options(rdev, type, info, &params);
......
...@@ -1697,7 +1697,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, ...@@ -1697,7 +1697,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy,
for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) { for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) {
num_interfaces += params->iftype_num[iftype]; num_interfaces += params->iftype_num[iftype];
if (params->iftype_num[iftype] > 0 && if (params->iftype_num[iftype] > 0 &&
!(wiphy->software_iftypes & BIT(iftype))) !cfg80211_iftype_allowed(wiphy, iftype, 0, 1))
used_iftypes |= BIT(iftype); used_iftypes |= BIT(iftype);
} }
...@@ -1719,7 +1719,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, ...@@ -1719,7 +1719,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy,
return -ENOMEM; return -ENOMEM;
for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) { for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) {
if (wiphy->software_iftypes & BIT(iftype)) if (cfg80211_iftype_allowed(wiphy, iftype, 0, 1))
continue; continue;
for (j = 0; j < c->n_limits; j++) { for (j = 0; j < c->n_limits; j++) {
all_iftypes |= limits[j].types; all_iftypes |= limits[j].types;
...@@ -2072,3 +2072,26 @@ int ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *cap, ...@@ -2072,3 +2072,26 @@ int ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *cap,
return max_vht_nss; return max_vht_nss;
} }
EXPORT_SYMBOL(ieee80211_get_vht_max_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);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment