Skip to content

Commit 0f75944

Browse files
committed
wifi: cfg80211: mlme: get BSS entry outside cfg80211_mlme_assoc()
Today it makes more sense to pass the necessary parameters to look up the BSS entry to cfg80211_mlme_assoc(), but with MLO we will need to look up multiple, and that gets awkward. Pull the lookup code into the callers so we can change it better. Signed-off-by: Johannes Berg <[email protected]>
1 parent 27f852d commit 0f75944

File tree

4 files changed

+27
-22
lines changed

4 files changed

+27
-22
lines changed

net/wireless/core.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,6 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
372372
const u8 *auth_data, int auth_data_len);
373373
int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
374374
struct net_device *dev,
375-
struct ieee80211_channel *chan,
376-
const u8 *bssid,
377-
const u8 *ssid, int ssid_len,
378375
struct cfg80211_assoc_request *req);
379376
int cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev,
380377
struct net_device *dev, const u8 *bssid,

net/wireless/mlme.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,9 @@ void cfg80211_oper_and_vht_capa(struct ieee80211_vht_cap *vht_capa,
309309
p1[i] &= p2[i];
310310
}
311311

312+
/* Note: caller must cfg80211_put_bss() regardless of result */
312313
int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
313314
struct net_device *dev,
314-
struct ieee80211_channel *chan,
315-
const u8 *bssid,
316-
const u8 *ssid, int ssid_len,
317315
struct cfg80211_assoc_request *req)
318316
{
319317
struct wireless_dev *wdev = dev->ieee80211_ptr;
@@ -331,18 +329,11 @@ int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
331329
cfg80211_oper_and_vht_capa(&req->vht_capa_mask,
332330
rdev->wiphy.vht_capa_mod_mask);
333331

334-
req->bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len,
335-
IEEE80211_BSS_TYPE_ESS,
336-
IEEE80211_PRIVACY_ANY);
337-
if (!req->bss)
338-
return -ENOENT;
339-
340332
err = rdev_assoc(rdev, dev, req);
341-
if (!err)
333+
if (!err) {
334+
cfg80211_ref_bss(&rdev->wiphy, req->bss);
342335
cfg80211_hold_bss(bss_from_pub(req->bss));
343-
else
344-
cfg80211_put_bss(&rdev->wiphy, req->bss);
345-
336+
}
346337
return err;
347338
}
348339

net/wireless/nl80211.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10431,7 +10431,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
1043110431
struct ieee80211_channel *chan;
1043210432
struct cfg80211_assoc_request req = {};
1043310433
const u8 *bssid, *ssid;
10434-
int err, ssid_len = 0;
10434+
int err, ssid_len;
1043510435
u32 freq;
1043610436

1043710437
if (dev->ieee80211_ptr->conn_owner_nlportid &&
@@ -10553,12 +10553,18 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
1055310553
sizeof(req.s1g_capa));
1055410554
}
1055510555

10556+
req.bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid,
10557+
ssid, ssid_len,
10558+
IEEE80211_BSS_TYPE_ESS,
10559+
IEEE80211_PRIVACY_ANY);
10560+
if (!req.bss)
10561+
return -ENOENT;
10562+
1055610563
err = nl80211_crypto_settings(rdev, info, &req.crypto, 1);
1055710564
if (!err) {
1055810565
wdev_lock(dev->ieee80211_ptr);
1055910566

10560-
err = cfg80211_mlme_assoc(rdev, dev, chan, bssid,
10561-
ssid, ssid_len, &req);
10567+
err = cfg80211_mlme_assoc(rdev, dev, &req);
1056210568

1056310569
if (!err && info->attrs[NL80211_ATTR_SOCKET_OWNER]) {
1056410570
dev->ieee80211_ptr->conn_owner_nlportid =
@@ -10570,6 +10576,8 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
1057010576
wdev_unlock(dev->ieee80211_ptr);
1057110577
}
1057210578

10579+
cfg80211_put_bss(&rdev->wiphy, req.bss);
10580+
1057310581
return err;
1057410582
}
1057510583

net/wireless/sme.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,18 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev,
193193
req.vht_capa = params->vht_capa;
194194
req.vht_capa_mask = params->vht_capa_mask;
195195

196-
err = cfg80211_mlme_assoc(rdev, wdev->netdev, params->channel,
197-
params->bssid, params->ssid,
198-
params->ssid_len, &req);
196+
req.bss = cfg80211_get_bss(&rdev->wiphy, params->channel,
197+
params->bssid,
198+
params->ssid, params->ssid_len,
199+
IEEE80211_BSS_TYPE_ESS,
200+
IEEE80211_PRIVACY_ANY);
201+
if (!req.bss) {
202+
err = -ENOENT;
203+
} else {
204+
err = cfg80211_mlme_assoc(rdev, wdev->netdev, &req);
205+
cfg80211_put_bss(&rdev->wiphy, req.bss);
206+
}
207+
199208
if (err)
200209
cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
201210
NULL, 0,

0 commit comments

Comments
 (0)