Skip to content

Commit 96c0695

Browse files
committed
wifi: cfg80211: fix MLO connection ownership
When disconnecting from an MLO connection we need the AP MLD address, not an arbitrary BSSID. Fix the code to do that. Fixes: 9ecff10 ("wifi: nl80211: refactor BSS lookup in nl80211_associate()") Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Gregory Greenman <[email protected]> Link: https://lore.kernel.org/r/20230301115906.4c1b3b18980e.I008f070c7f3b8e8bde9278101ef9e40706a82902@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent ce04abc commit 96c0695

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

net/wireless/nl80211.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10799,8 +10799,7 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
1079910799

1080010800
static struct cfg80211_bss *nl80211_assoc_bss(struct cfg80211_registered_device *rdev,
1080110801
const u8 *ssid, int ssid_len,
10802-
struct nlattr **attrs,
10803-
const u8 **bssid_out)
10802+
struct nlattr **attrs)
1080410803
{
1080510804
struct ieee80211_channel *chan;
1080610805
struct cfg80211_bss *bss;
@@ -10827,7 +10826,6 @@ static struct cfg80211_bss *nl80211_assoc_bss(struct cfg80211_registered_device
1082710826
if (!bss)
1082810827
return ERR_PTR(-ENOENT);
1082910828

10830-
*bssid_out = bssid;
1083110829
return bss;
1083210830
}
1083310831

@@ -10837,7 +10835,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
1083710835
struct net_device *dev = info->user_ptr[1];
1083810836
struct cfg80211_assoc_request req = {};
1083910837
struct nlattr **attrs = NULL;
10840-
const u8 *bssid, *ssid;
10838+
const u8 *ap_addr, *ssid;
1084110839
unsigned int link_id;
1084210840
int err, ssid_len;
1084310841

@@ -10974,6 +10972,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
1097410972
return -EINVAL;
1097510973

1097610974
req.ap_mld_addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]);
10975+
ap_addr = req.ap_mld_addr;
1097710976

1097810977
attrs = kzalloc(attrsize, GFP_KERNEL);
1097910978
if (!attrs)
@@ -10999,8 +10998,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
1099910998
goto free;
1100010999
}
1100111000
req.links[link_id].bss =
11002-
nl80211_assoc_bss(rdev, ssid, ssid_len, attrs,
11003-
&bssid);
11001+
nl80211_assoc_bss(rdev, ssid, ssid_len, attrs);
1100411002
if (IS_ERR(req.links[link_id].bss)) {
1100511003
err = PTR_ERR(req.links[link_id].bss);
1100611004
req.links[link_id].bss = NULL;
@@ -11051,10 +11049,10 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
1105111049
if (req.link_id >= 0)
1105211050
return -EINVAL;
1105311051

11054-
req.bss = nl80211_assoc_bss(rdev, ssid, ssid_len, info->attrs,
11055-
&bssid);
11052+
req.bss = nl80211_assoc_bss(rdev, ssid, ssid_len, info->attrs);
1105611053
if (IS_ERR(req.bss))
1105711054
return PTR_ERR(req.bss);
11055+
ap_addr = req.bss->bssid;
1105811056
}
1105911057

1106011058
err = nl80211_crypto_settings(rdev, info, &req.crypto, 1);
@@ -11067,7 +11065,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
1106711065
dev->ieee80211_ptr->conn_owner_nlportid =
1106811066
info->snd_portid;
1106911067
memcpy(dev->ieee80211_ptr->disconnect_bssid,
11070-
bssid, ETH_ALEN);
11068+
ap_addr, ETH_ALEN);
1107111069
}
1107211070

1107311071
wdev_unlock(dev->ieee80211_ptr);

0 commit comments

Comments
 (0)