Browse Source

qcacld-3.0: Fix null session dereference in lim_populate_he_mcs_set

Currently, ch_width of session is checked without validating
session  which may lead to NULL pointer derefrence.

validate session_entry before accessing element of
pe_session

Change-Id: I1f785555fa77a0c588e9b5245ad513fe059974d0
CRs-Fixed: 2585928
sheenam monga 5 years ago
parent
commit
ec59a16f71
1 changed files with 6 additions and 1 deletions
  1. 6 1
      core/mac/src/pe/lim/lim_utils.c

+ 6 - 1
core/mac/src/pe/lim/lim_utils.c

@@ -7409,6 +7409,11 @@ QDF_STATUS lim_populate_he_mcs_set(struct mac_context *mac_ctx,
 		return QDF_STATUS_SUCCESS;
 	}
 
+	if (!session_entry) {
+		pe_err("session is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	pe_debug("peer rates lt 80: rx_mcs - 0x%04x tx_mcs - 0x%04x",
 		peer_he_caps->rx_he_mcs_map_lt_80,
 		peer_he_caps->tx_he_mcs_map_lt_80);
@@ -7419,7 +7424,7 @@ QDF_STATUS lim_populate_he_mcs_set(struct mac_context *mac_ctx,
 		(*(uint16_t *)peer_he_caps->rx_he_mcs_map_80_80),
 		(*(uint16_t *)peer_he_caps->tx_he_mcs_map_80_80));
 
-	if (session_entry && session_entry->nss == NSS_2x2_MODE) {
+	if (session_entry->nss == NSS_2x2_MODE) {
 		if (mac_ctx->lteCoexAntShare &&
 		    wlan_reg_is_24ghz_ch_freq(session_entry->curr_op_freq)) {
 			if (IS_2X2_CHAIN(session_entry->chainMask))