diff --git a/components/mlme/core/inc/wlan_mlme_main.h b/components/mlme/core/inc/wlan_mlme_main.h index 02f1fdcd2a44..4f048a49782d 100644 --- a/components/mlme/core/inc/wlan_mlme_main.h +++ b/components/mlme/core/inc/wlan_mlme_main.h @@ -57,10 +57,14 @@ struct wlan_ies { * struct peer_mlme_priv_obj - peer MLME component object * @ucast_key_cipher: unicast crypto type. * @is_pmf_enabled: True if PMF is enabled + * @last_assoc_received_time: last assoc received time + * @last_disassoc_deauth_received_time: last disassoc/deauth received time */ struct peer_mlme_priv_obj { uint32_t ucast_key_cipher; bool is_pmf_enabled; + qdf_time_t last_assoc_received_time; + qdf_time_t last_disassoc_deauth_received_time; }; /** diff --git a/core/mac/src/dph/dph_hash_table.c b/core/mac/src/dph/dph_hash_table.c index 187ab40c1a3c..f181c4b228ec 100644 --- a/core/mac/src/dph/dph_hash_table.c +++ b/core/mac/src/dph/dph_hash_table.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -196,8 +196,6 @@ tpDphHashNode dph_init_sta_state(struct mac_context *mac, tSirMacAddr staAddr, sta->added = 1; sta->is_disassoc_deauth_in_progress = 0; - sta->last_assoc_received_time = 0; - sta->last_disassoc_deauth_received_time = 0; sta->sta_deletion_in_progress = false; sta->valid = 1; return sta; @@ -334,8 +332,6 @@ QDF_STATUS dph_delete_hash_entry(struct mac_context *mac, tSirMacAddr staAddr, prev->next = ptr->next; ptr->added = 0; ptr->is_disassoc_deauth_in_progress = 0; - ptr->last_assoc_received_time = 0; - ptr->last_disassoc_deauth_received_time = 0; ptr->sta_deletion_in_progress = false; ptr->next = 0; } else { diff --git a/core/mac/src/include/dph_global.h b/core/mac/src/include/dph_global.h index 43df2d5d4475..f9ed4cad6e5b 100644 --- a/core/mac/src/include/dph_global.h +++ b/core/mac/src/include/dph_global.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -171,8 +171,6 @@ typedef struct sDphHashNode { /* key installed for this STA or not in the firmware */ uint8_t is_key_installed; uint8_t is_disassoc_deauth_in_progress; - qdf_time_t last_assoc_received_time; - qdf_time_t last_disassoc_deauth_received_time; uint8_t nss; int8_t del_sta_ctx_rssi; diff --git a/core/mac/src/pe/lim/lim_api.c b/core/mac/src/pe/lim/lim_api.c index fe3672cad1e3..e845edb58900 100644 --- a/core/mac/src/pe/lim/lim_api.c +++ b/core/mac/src/pe/lim/lim_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -2613,9 +2613,8 @@ tMgmtFrmDropReason lim_is_pkt_candidate_for_drop(struct mac_context *mac, } else if ((subType == SIR_MAC_MGMT_ASSOC_REQ) || (subType == SIR_MAC_MGMT_DISASSOC) || (subType == SIR_MAC_MGMT_DEAUTH)) { - uint16_t assoc_id; - struct dph_hash_table *dph_table; - tDphHashNode *sta_ds; + struct peer_mlme_priv_obj *peer_priv; + struct wlan_objmgr_peer *peer; qdf_time_t *timestamp; pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); @@ -2623,20 +2622,34 @@ tMgmtFrmDropReason lim_is_pkt_candidate_for_drop(struct mac_context *mac, &sessionId); if (!pe_session) return eMGMT_DROP_SPURIOUS_FRAME; - dph_table = &pe_session->dph.dphHashTable; - sta_ds = dph_lookup_hash_entry(mac, pHdr->sa, &assoc_id, - dph_table); - if (!sta_ds) { + + peer = wlan_objmgr_get_peer_by_mac(mac->psoc, + pHdr->sa, + WLAN_LEGACY_MAC_ID); + if (!peer) { if (subType == SIR_MAC_MGMT_ASSOC_REQ) return eMGMT_DROP_NO_DROP; - else - return eMGMT_DROP_SPURIOUS_FRAME; + + return eMGMT_DROP_SPURIOUS_FRAME; + } + + peer_priv = wlan_objmgr_peer_get_comp_private_obj(peer, + WLAN_UMAC_COMP_MLME); + if (!peer_priv) { + wlan_objmgr_peer_release_ref(peer, WLAN_LEGACY_MAC_ID); + if (subType == SIR_MAC_MGMT_ASSOC_REQ) + return eMGMT_DROP_NO_DROP; + + return eMGMT_DROP_SPURIOUS_FRAME; } if (subType == SIR_MAC_MGMT_ASSOC_REQ) - timestamp = &sta_ds->last_assoc_received_time; + timestamp = + &peer_priv->last_assoc_received_time; else - timestamp = &sta_ds->last_disassoc_deauth_received_time; + timestamp = + &peer_priv->last_disassoc_deauth_received_time; + if (*timestamp > 0 && qdf_system_time_before(qdf_get_system_timestamp(), *timestamp + @@ -2646,10 +2659,12 @@ tMgmtFrmDropReason lim_is_pkt_candidate_for_drop(struct mac_context *mac, (int)(qdf_get_system_timestamp() - *timestamp), "of last frame. Allow it only after", LIM_DOS_PROTECTION_TIME); + wlan_objmgr_peer_release_ref(peer, WLAN_LEGACY_MAC_ID); return eMGMT_DROP_EXCESSIVE_MGMT_FRAME; } *timestamp = qdf_get_system_timestamp(); + wlan_objmgr_peer_release_ref(peer, WLAN_LEGACY_MAC_ID); }