Commit 8f6e0dfc authored by Johannes Berg's avatar Johannes Berg

wifi: cfg80211: remove BSS pointer from cfg80211_disassoc_request

The race described by the comment in mac80211 hasn't existed
since the locking rework to use the same lock and for MLO we
need to pass the AP MLD address, so just pass the BSSID or
AP MLD address instead of the BSS struct pointer, and adjust
all the code accordingly.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 98b0b467
...@@ -2886,7 +2886,7 @@ struct cfg80211_assoc_request { ...@@ -2886,7 +2886,7 @@ struct cfg80211_assoc_request {
* This structure provides information needed to complete IEEE 802.11 * This structure provides information needed to complete IEEE 802.11
* deauthentication. * deauthentication.
* *
* @bssid: the BSSID of the BSS to deauthenticate from * @bssid: the BSSID or AP MLD address to deauthenticate from
* @ie: Extra IEs to add to Deauthentication frame or %NULL * @ie: Extra IEs to add to Deauthentication frame or %NULL
* @ie_len: Length of ie buffer in octets * @ie_len: Length of ie buffer in octets
* @reason_code: The reason code for the deauthentication * @reason_code: The reason code for the deauthentication
...@@ -2907,7 +2907,7 @@ struct cfg80211_deauth_request { ...@@ -2907,7 +2907,7 @@ struct cfg80211_deauth_request {
* This structure provides information needed to complete IEEE 802.11 * This structure provides information needed to complete IEEE 802.11
* disassociation. * disassociation.
* *
* @bss: the BSS to disassociate from * @ap_addr: the BSSID or AP MLD address to disassociate from
* @ie: Extra IEs to add to Disassociation frame or %NULL * @ie: Extra IEs to add to Disassociation frame or %NULL
* @ie_len: Length of ie buffer in octets * @ie_len: Length of ie buffer in octets
* @reason_code: The reason code for the disassociation * @reason_code: The reason code for the disassociation
...@@ -2915,7 +2915,7 @@ struct cfg80211_deauth_request { ...@@ -2915,7 +2915,7 @@ struct cfg80211_deauth_request {
* Disassociation frame is to be transmitted. * Disassociation frame is to be transmitted.
*/ */
struct cfg80211_disassoc_request { struct cfg80211_disassoc_request {
struct cfg80211_bss *bss; const u8 *ap_addr;
const u8 *ie; const u8 *ie;
size_t ie_len; size_t ie_len;
u16 reason_code; u16 reason_code;
......
...@@ -6426,18 +6426,14 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, ...@@ -6426,18 +6426,14 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
{ {
u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN]; u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN];
/* if (!sdata->u.mgd.associated ||
* cfg80211 should catch this ... but it's racy since memcmp(sdata->vif.cfg.ap_addr, req->ap_addr, ETH_ALEN))
* we can receive a disassoc frame, process it, hand it return -ENOTCONN;
* to cfg80211 while that's in a locked section already
* trying to tell us that the user wants to disconnect.
*/
if (sdata->deflink.u.mgd.bss != req->bss)
return -ENOLINK;
sdata_info(sdata, sdata_info(sdata,
"disassociating from %pM by local choice (Reason: %u=%s)\n", "disassociating from %pM by local choice (Reason: %u=%s)\n",
req->bss->bssid, req->reason_code, ieee80211_get_reason_code_string(req->reason_code)); req->ap_addr, req->reason_code,
ieee80211_get_reason_code_string(req->reason_code));
ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DISASSOC, ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DISASSOC,
req->reason_code, !req->local_state_change, req->reason_code, !req->local_state_change,
......
...@@ -372,7 +372,7 @@ int cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev, ...@@ -372,7 +372,7 @@ int cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev,
const u8 *ie, int ie_len, u16 reason, const u8 *ie, int ie_len, u16 reason,
bool local_state_change); bool local_state_change);
int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev, int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev,
struct net_device *dev, const u8 *bssid, struct net_device *dev, const u8 *ap_addr,
const u8 *ie, int ie_len, u16 reason, const u8 *ie, int ie_len, u16 reason,
bool local_state_change); bool local_state_change);
void cfg80211_mlme_down(struct cfg80211_registered_device *rdev, void cfg80211_mlme_down(struct cfg80211_registered_device *rdev,
......
...@@ -370,7 +370,7 @@ int cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev, ...@@ -370,7 +370,7 @@ int cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev,
} }
int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev, int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev,
struct net_device *dev, const u8 *bssid, struct net_device *dev, const u8 *ap_addr,
const u8 *ie, int ie_len, u16 reason, const u8 *ie, int ie_len, u16 reason,
bool local_state_change) bool local_state_change)
{ {
...@@ -380,6 +380,7 @@ int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev, ...@@ -380,6 +380,7 @@ int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev,
.local_state_change = local_state_change, .local_state_change = local_state_change,
.ie = ie, .ie = ie,
.ie_len = ie_len, .ie_len = ie_len,
.ap_addr = ap_addr,
}; };
int err; int err;
...@@ -388,10 +389,7 @@ int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev, ...@@ -388,10 +389,7 @@ int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev,
if (!wdev->connected) if (!wdev->connected)
return -ENOTCONN; return -ENOTCONN;
if (ether_addr_equal(wdev->links[0].client.current_bss->pub.bssid, if (memcmp(wdev->u.client.connected_addr, ap_addr, ETH_ALEN))
bssid))
req.bss = &wdev->links[0].client.current_bss->pub;
else
return -ENOTCONN; return -ENOTCONN;
err = rdev_disassoc(rdev, dev, &req); err = rdev_disassoc(rdev, dev, &req);
......
...@@ -1318,10 +1318,7 @@ TRACE_EVENT(rdev_disassoc, ...@@ -1318,10 +1318,7 @@ TRACE_EVENT(rdev_disassoc,
TP_fast_assign( TP_fast_assign(
WIPHY_ASSIGN; WIPHY_ASSIGN;
NETDEV_ASSIGN; NETDEV_ASSIGN;
if (req->bss) MAC_ASSIGN(bssid, req->ap_addr);
MAC_ASSIGN(bssid, req->bss->bssid);
else
eth_zero_addr(__entry->bssid);
__entry->reason_code = req->reason_code; __entry->reason_code = req->reason_code;
__entry->local_state_change = req->local_state_change; __entry->local_state_change = req->local_state_change;
), ),
......
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