Browse Source

qcacld-3.0: Add NULL pointer check

In the following functions, add NULL pointer check to
address the following issues:
  - lim_send_sme_ndp_add_sta_rsp
  - sme_process_set_hw_mode_resp
  - sme_update_new_channel_event
  - sme_change_mcc_beacon_interval
  - sme_pdev_set_hw_mode
  - sme_nss_update_request
  - sme_soc_set_dual_mac_config

Change-Id: I55038966474b775fba514591c2657228af4f8769
CRs-Fixed: 2168378
Min Liu 7 years ago
parent
commit
e98cbdec19
1 changed files with 13 additions and 1 deletions
  1. 13 1
      core/mac/src/pe/nan/nan_datapath.c

+ 13 - 1
core/mac/src/pe/nan/nan_datapath.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -942,13 +942,24 @@ static QDF_STATUS lim_send_sme_ndp_add_sta_rsp(tpAniSirGlobal mac_ctx,
 		pe_debug("Invalid add_sta_rsp");
 		return QDF_STATUS_E_INVAL;
 	}
+
+	if (!psoc) {
+		pe_debug("Invalid psoc");
+		return QDF_STATUS_E_INVAL;
+	}
+
 	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc,
 						    add_sta_rsp->smesessionId,
 						    WLAN_NAN_ID);
+	if (!vdev) {
+		pe_debug("Invalid vdev");
+		return QDF_STATUS_E_INVAL;
+	}
 
 	new_peer_ind = qdf_mem_malloc(sizeof(*new_peer_ind));
 	if (!new_peer_ind) {
 		pe_debug("Failed to allocate memory");
+		wlan_objmgr_vdev_release_ref(vdev, WLAN_NAN_ID);
 		return QDF_STATUS_E_NOMEM;
 	}
 
@@ -959,6 +970,7 @@ static QDF_STATUS lim_send_sme_ndp_add_sta_rsp(tpAniSirGlobal mac_ctx,
 	new_peer_ind->sta_id = add_sta_rsp->staIdx;
 
 	ucfg_nan_event_handler(psoc, vdev, NDP_NEW_PEER, new_peer_ind);
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_NAN_ID);
 	return QDF_STATUS_SUCCESS;
 }
 #endif