diff --git a/core/mac/src/pe/lim/lim_process_auth_frame.c b/core/mac/src/pe/lim/lim_process_auth_frame.c index f4d0216345b8..607555e8c5e2 100644 --- a/core/mac/src/pe/lim/lim_process_auth_frame.c +++ b/core/mac/src/pe/lim/lim_process_auth_frame.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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 @@ -428,7 +429,7 @@ static void lim_process_sae_auth_frame(struct mac_context *mac_ctx, pe_session->limMlmState); if (LIM_IS_AP_ROLE(pe_session)) { - struct tLimPreAuthNode *sta_pre_auth_ctx; + struct tLimPreAuthNode *pre_auth_node; rx_flags = RXMGMT_FLAG_EXTERNAL_AUTH; /* Add preauth node when the first SAE authentication frame @@ -438,12 +439,16 @@ static void lim_process_sae_auth_frame(struct mac_context *mac_ctx, * SAE protocol optimizations. */ /* Extract pre-auth context for the STA, if any. */ - sta_pre_auth_ctx = lim_search_pre_auth_list(mac_ctx, - mac_hdr->sa); - if (!sta_pre_auth_ctx || - (sta_pre_auth_ctx->mlmState != eLIM_MLM_WT_SAE_AUTH_STATE && - sta_pre_auth_ctx->mlmState != - eLIM_MLM_AUTHENTICATED_STATE)) { + pre_auth_node = lim_search_pre_auth_list(mac_ctx, mac_hdr->sa); + if (!pre_auth_node || + (pre_auth_node->mlmState != eLIM_MLM_WT_SAE_AUTH_STATE)) { + if (pre_auth_node) { + pe_debug("Delete existing preauth node for SAE peer in state: %u " + QDF_MAC_ADDR_FMT, + pre_auth_node->mlmState, + QDF_MAC_ADDR_REF(mac_hdr->sa)); + lim_delete_pre_auth_node(mac_ctx, mac_hdr->sa); + } lim_external_auth_add_pre_auth_node(mac_ctx, mac_hdr, eLIM_MLM_WT_SAE_AUTH_STATE); }