From 6b0efbae45b71047032c0197d462bc8fcbe76025 Mon Sep 17 00:00:00 2001 From: Lin Bai Date: Thu, 25 Jul 2019 12:54:39 +0800 Subject: [PATCH] qcacld-3.0: vdev_id misused when handling DEAUTH ind When STA receives DEAUTH ind event from target, vdev_id will be mis-used as PE session ID when invoking lim_tear_down_link_with_ap. Also enhanced related log for more useful info. Change-Id: I755e0e170c36205ef20a21955546cc36437c1be4 CRs-Fixed: 2491669 --- core/mac/src/pe/lim/lim_api.c | 2 +- .../mac/src/pe/lim/lim_link_monitoring_algo.c | 41 ++++++++++--------- core/sme/src/csr/csr_api_roam.c | 4 +- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/core/mac/src/pe/lim/lim_api.c b/core/mac/src/pe/lim/lim_api.c index 46e8fc2785fa..3d00e8a8ac51 100644 --- a/core/mac/src/pe/lim/lim_api.c +++ b/core/mac/src/pe/lim/lim_api.c @@ -2294,7 +2294,7 @@ pe_disconnect_callback(struct mac_context *mac, uint8_t vdev_id, lim_extract_ies_from_deauth_disassoc(session, deauth_disassoc_frame, deauth_disassoc_frame_len); - lim_tear_down_link_with_ap(mac, vdev_id, + lim_tear_down_link_with_ap(mac, session->peSessionId, eSIR_MAC_UNSPEC_FAILURE_REASON); return QDF_STATUS_SUCCESS; diff --git a/core/mac/src/pe/lim/lim_link_monitoring_algo.c b/core/mac/src/pe/lim/lim_link_monitoring_algo.c index ede079888f4a..712f544822ee 100644 --- a/core/mac/src/pe/lim/lim_link_monitoring_algo.c +++ b/core/mac/src/pe/lim/lim_link_monitoring_algo.c @@ -373,7 +373,8 @@ lim_tear_down_link_with_ap(struct mac_context *mac, uint8_t sessionId, */ pe_session->pmmOffloadInfo.bcnmiss = false; - pe_info("No ProbeRsp from AP after HB failure. Tearing down link"); + pe_info("No ProbeRsp from AP after HB failure for pe/sme id %d/%d", + pe_session->peSessionId, pe_session->smeSessionId); /* Announce loss of link to Roaming algorithm */ /* and cleanup by sending SME_DISASSOC_REQ to SME */ @@ -405,28 +406,28 @@ lim_tear_down_link_with_ap(struct mac_context *mac, uint8_t sessionId, qdf_mem_copy((uint8_t *) &mlmDeauthInd.peerMacAddr, sta->staAddr, sizeof(tSirMacAddr)); - /* - * if deauth_before_connection is enabled and reasoncode is - * Beacon Missed Store the MAC of AP in the flip flop - * buffer. This MAC will be used to send Deauth before - * connection, if we connect to same AP after HB failure. - */ - if (mac->mlme_cfg->sta.deauth_before_connection && - eSIR_BEACON_MISSED == reasonCode) { - int apCount = mac->lim.gLimHeartBeatApMacIndex; + /* + * if deauth_before_connection is enabled and reasoncode is + * Beacon Missed Store the MAC of AP in the flip flop + * buffer. This MAC will be used to send Deauth before + * connection, if we connect to same AP after HB failure. + */ + if (mac->mlme_cfg->sta.deauth_before_connection && + eSIR_BEACON_MISSED == reasonCode) { + int apCount = mac->lim.gLimHeartBeatApMacIndex; - if (mac->lim.gLimHeartBeatApMacIndex) - mac->lim.gLimHeartBeatApMacIndex = 0; - else - mac->lim.gLimHeartBeatApMacIndex = 1; + if (mac->lim.gLimHeartBeatApMacIndex) + mac->lim.gLimHeartBeatApMacIndex = 0; + else + mac->lim.gLimHeartBeatApMacIndex = 1; - pe_debug("HB Failure on MAC " - QDF_MAC_ADDR_STR" Store it on Index %d", - QDF_MAC_ADDR_ARRAY(sta->staAddr), apCount); + pe_debug("HB Failure on MAC " + QDF_MAC_ADDR_STR" Store it on Index %d", + QDF_MAC_ADDR_ARRAY(sta->staAddr), apCount); - sir_copy_mac_addr(mac->lim.gLimHeartBeatApMac[apCount], - sta->staAddr); - } + sir_copy_mac_addr(mac->lim.gLimHeartBeatApMac[apCount], + sta->staAddr); + } mlmDeauthInd.reasonCode = (uint8_t) sta->mlmStaContext.disassocReason; diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index f23e318aaa4e..385baba841be 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -11495,8 +11495,10 @@ csr_roam_chk_lnk_deauth_ind(struct mac_context *mac_ctx, tSirSmeRsp *msg_ptr) QDF_STATUS status; struct deauth_ind *pDeauthInd; - sme_debug("DEAUTHENTICATION Indication from MAC"); pDeauthInd = (struct deauth_ind *)msg_ptr; + sme_debug("DEAUTH Indication from MAC for session %d bssid %pM", + pDeauthInd->sessionId, pDeauthInd->bssid.bytes); + status = csr_roam_get_session_id_from_bssid(mac_ctx, &pDeauthInd->bssid, &sessionId);