From fffa0b4131e2dc53e46fdc7480acd8d4077aed3e Mon Sep 17 00:00:00 2001 From: Srinivas Dasari Date: Fri, 27 Sep 2019 14:22:47 +0530 Subject: [PATCH] qcacld-3.0: Free the cached assoc request if a new assoc req rcvd Driver caches the assoc request received from an SAE STA if it's received before getting external auth(SAE) status from hostapd. Station might retry the assoc frame(ex: if it doesn't get assoc response within a specific interval) and the cached assoc request is overwritten with new assoc request, but the cached assoc request is not freed. Free the same to avoid memleaks. Change-Id: I576f3b8b05d17afc66481419d1b5bdc0765c84aa CRs-Fixed: 2535425 --- core/mac/src/pe/lim/lim_process_assoc_req_frame.c | 11 +++++++++++ core/mac/src/pe/lim/lim_security_utils.c | 1 + 2 files changed, 12 insertions(+) diff --git a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c index 454c1916db5b..6a81d510056e 100644 --- a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c +++ b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c @@ -1968,8 +1968,19 @@ static void lim_defer_sme_indication(struct mac_context *mac_ctx, struct sDphHashNode *sta_ds) { struct tLimPreAuthNode *sta_pre_auth_ctx; + struct lim_assoc_data *cached_req; + /* Extract pre-auth context for the STA, if any. */ sta_pre_auth_ctx = lim_search_pre_auth_list(mac_ctx, hdr->sa); + if (sta_pre_auth_ctx->assoc_req.present) { + pe_debug("Free the cached assoc req as a new one is received"); + cached_req = &sta_pre_auth_ctx->assoc_req; + lim_process_assoc_cleanup(mac_ctx, session, + cached_req->assoc_req, + cached_req->sta_ds, + cached_req->assoc_req_copied); + } + sta_pre_auth_ctx->assoc_req.present = true; sta_pre_auth_ctx->assoc_req.sub_type = sub_type; qdf_mem_copy(&sta_pre_auth_ctx->assoc_req.hdr, hdr, diff --git a/core/mac/src/pe/lim/lim_security_utils.c b/core/mac/src/pe/lim/lim_security_utils.c index 4efb0891a1c6..2d3408cc8699 100644 --- a/core/mac/src/pe/lim/lim_security_utils.c +++ b/core/mac/src/pe/lim/lim_security_utils.c @@ -314,6 +314,7 @@ void lim_release_pre_auth_node(struct mac_context *mac, if (assoc->assocReqFrameLength) qdf_mem_free(assoc->assocReqFrame); qdf_mem_free(assoc); + pAuthNode->assoc_req.assoc_req = NULL; pAuthNode->assoc_req.present = false; } MTRACE(mac_trace