Commit c2653990 authored by Johannes Berg's avatar Johannes Berg

wifi: nl80211: acquire wdev mutex earlier in start_ap

We need to hold the wdev mutex already in order to call
nl80211_parse_tx_bitrate_mask(), so acquire it earlier.

Fixes: 7b0a0e3c ("wifi: cfg80211: do some rework towards MLO link APIs")
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 206bbcf7
...@@ -5771,18 +5771,20 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) ...@@ -5771,18 +5771,20 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
goto out; goto out;
} }
wdev_lock(wdev);
if (info->attrs[NL80211_ATTR_TX_RATES]) { if (info->attrs[NL80211_ATTR_TX_RATES]) {
err = nl80211_parse_tx_bitrate_mask(info, info->attrs, err = nl80211_parse_tx_bitrate_mask(info, info->attrs,
NL80211_ATTR_TX_RATES, NL80211_ATTR_TX_RATES,
&params->beacon_rate, &params->beacon_rate,
dev, false, link_id); dev, false, link_id);
if (err) if (err)
goto out; goto out_unlock;
err = validate_beacon_tx_rate(rdev, params->chandef.chan->band, err = validate_beacon_tx_rate(rdev, params->chandef.chan->band,
&params->beacon_rate); &params->beacon_rate);
if (err) if (err)
goto out; goto out_unlock;
} }
if (info->attrs[NL80211_ATTR_SMPS_MODE]) { if (info->attrs[NL80211_ATTR_SMPS_MODE]) {
...@@ -5795,19 +5797,19 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) ...@@ -5795,19 +5797,19 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
if (!(rdev->wiphy.features & if (!(rdev->wiphy.features &
NL80211_FEATURE_STATIC_SMPS)) { NL80211_FEATURE_STATIC_SMPS)) {
err = -EINVAL; err = -EINVAL;
goto out; goto out_unlock;
} }
break; break;
case NL80211_SMPS_DYNAMIC: case NL80211_SMPS_DYNAMIC:
if (!(rdev->wiphy.features & if (!(rdev->wiphy.features &
NL80211_FEATURE_DYNAMIC_SMPS)) { NL80211_FEATURE_DYNAMIC_SMPS)) {
err = -EINVAL; err = -EINVAL;
goto out; goto out_unlock;
} }
break; break;
default: default:
err = -EINVAL; err = -EINVAL;
goto out; goto out_unlock;
} }
} else { } else {
params->smps_mode = NL80211_SMPS_OFF; params->smps_mode = NL80211_SMPS_OFF;
...@@ -5816,7 +5818,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) ...@@ -5816,7 +5818,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
params->pbss = nla_get_flag(info->attrs[NL80211_ATTR_PBSS]); params->pbss = nla_get_flag(info->attrs[NL80211_ATTR_PBSS]);
if (params->pbss && !rdev->wiphy.bands[NL80211_BAND_60GHZ]) { if (params->pbss && !rdev->wiphy.bands[NL80211_BAND_60GHZ]) {
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto out; goto out_unlock;
} }
if (info->attrs[NL80211_ATTR_ACL_POLICY]) { if (info->attrs[NL80211_ATTR_ACL_POLICY]) {
...@@ -5824,7 +5826,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) ...@@ -5824,7 +5826,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
if (IS_ERR(params->acl)) { if (IS_ERR(params->acl)) {
err = PTR_ERR(params->acl); err = PTR_ERR(params->acl);
params->acl = NULL; params->acl = NULL;
goto out; goto out_unlock;
} }
} }
...@@ -5836,7 +5838,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) ...@@ -5836,7 +5838,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
info->attrs[NL80211_ATTR_HE_OBSS_PD], info->attrs[NL80211_ATTR_HE_OBSS_PD],
&params->he_obss_pd); &params->he_obss_pd);
if (err) if (err)
goto out; goto out_unlock;
} }
if (info->attrs[NL80211_ATTR_FILS_DISCOVERY]) { if (info->attrs[NL80211_ATTR_FILS_DISCOVERY]) {
...@@ -5844,7 +5846,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) ...@@ -5844,7 +5846,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
info->attrs[NL80211_ATTR_FILS_DISCOVERY], info->attrs[NL80211_ATTR_FILS_DISCOVERY],
params); params);
if (err) if (err)
goto out; goto out_unlock;
} }
if (info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP]) { if (info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP]) {
...@@ -5852,7 +5854,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) ...@@ -5852,7 +5854,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
rdev, info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP], rdev, info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP],
params); params);
if (err) if (err)
goto out; goto out_unlock;
} }
if (info->attrs[NL80211_ATTR_MBSSID_CONFIG]) { if (info->attrs[NL80211_ATTR_MBSSID_CONFIG]) {
...@@ -5863,7 +5865,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) ...@@ -5863,7 +5865,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
params->beacon.mbssid_ies->cnt : params->beacon.mbssid_ies->cnt :
0); 0);
if (err) if (err)
goto out; goto out_unlock;
} }
nl80211_calculate_ap_params(params); nl80211_calculate_ap_params(params);
...@@ -5874,7 +5876,6 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) ...@@ -5874,7 +5876,6 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
else if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT]) else if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])
params->flags |= NL80211_AP_SETTINGS_EXTERNAL_AUTH_SUPPORT; params->flags |= NL80211_AP_SETTINGS_EXTERNAL_AUTH_SUPPORT;
wdev_lock(wdev);
if (wdev->conn_owner_nlportid && if (wdev->conn_owner_nlportid &&
info->attrs[NL80211_ATTR_SOCKET_OWNER] && info->attrs[NL80211_ATTR_SOCKET_OWNER] &&
wdev->conn_owner_nlportid != info->snd_portid) { wdev->conn_owner_nlportid != info->snd_portid) {
......
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