diff mbox series

[12/18] wifi: mac80211: Check if we had first beacon with relevant links

Message ID 20230928172905.3fe476aa83e5.Ic1505cf3d60f74580d31efa7e52046947c490b85@changeid
State Superseded
Headers show
Series cfg80211/mac80211 patches from our internal tree 2023-09-28 | expand

Commit Message

Greenman, Gregory Sept. 28, 2023, 2:35 p.m. UTC
From: Miri Korenblit <miriam.rachel.korenblit@intel.com>

If there is a disassoc before the fisrt beacon we need to protect a
session for the deauth frame. Currently we are checking if we had a
beacon in the default link, which is wrong in a MLO connection and
link id != 0.
Fix this by checking all the active links, if non had a beacon then
protect a session.
If at least one link had a beacon there is no need for session
protection.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
---
 net/mac80211/mlme.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

Comments

Jeff Johnson Sept. 28, 2023, 11:57 p.m. UTC | #1
On 9/28/2023 7:35 AM, gregory.greenman@intel.com wrote:
> From: Miri Korenblit <miriam.rachel.korenblit@intel.com>
> 
> If there is a disassoc before the fisrt beacon we need to protect a
> session for the deauth frame. Currently we are checking if we had a
> beacon in the default link, which is wrong in a MLO connection and
> link id != 0.
> Fix this by checking all the active links, if non had a beacon then

s/ non / none /
diff mbox series

Patch

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index e92598dcf3ed..e3db27ec6793 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2935,9 +2935,20 @@  static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
 		 * deauthentication frame by calling mgd_prepare_tx, if the
 		 * driver requested so.
 		 */
-		if (ieee80211_hw_check(&local->hw, DEAUTH_NEED_MGD_TX_PREP) &&
-		    !sdata->deflink.u.mgd.have_beacon) {
-			drv_mgd_prepare_tx(sdata->local, sdata, &info);
+		if (ieee80211_hw_check(&local->hw, DEAUTH_NEED_MGD_TX_PREP)) {
+			for (link_id = 0; link_id < ARRAY_SIZE(sdata->link);
+			     link_id++) {
+				struct ieee80211_link_data *link;
+
+				link = sdata_dereference(sdata->link[link_id],
+							 sdata);
+				if (!link)
+					continue;
+				if (link->u.mgd.have_beacon)
+					break;
+			}
+			if (link_id == IEEE80211_MLD_MAX_NUM_LINKS)
+				drv_mgd_prepare_tx(sdata->local, sdata, &info);
 		}
 
 		ieee80211_send_deauth_disassoc(sdata, sdata->vif.cfg.ap_addr,