Parcourir la source

qcacld-3.0: Validate mac_ctx before using it

Validate mac_ctx before dereferencing it.

Change-Id: Iba786647c5a54e0a67ff7b9cbb0dbaea3bd52d76
CRs-Fixed: 2699734
Gururaj Pandurangi il y a 4 ans
Parent
commit
7fe6ad582f
1 fichiers modifiés avec 7 ajouts et 1 suppressions
  1. 7 1
      core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c

+ 7 - 1
core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c

@@ -1658,13 +1658,19 @@ lim_process_mlm_del_all_sta_rsp(struct vdev_mlme_obj *vdev_mlme,
 {
 	struct pe_session *session_entry;
 	tSirResultCodes status_code = eSIR_SME_SUCCESS;
-	struct mac_context *mac_ctx = cds_get_context(QDF_MODULE_ID_PE);
+	struct mac_context *mac_ctx;
 	struct wlan_objmgr_vdev *vdev;
 	uint8_t vdev_id;
 
 	vdev = vdev_mlme->vdev;
 	vdev_id = wlan_vdev_get_id(vdev);
 
+	mac_ctx = cds_get_context(QDF_MODULE_ID_PE);
+	if (!mac_ctx) {
+		pe_err("mac_ctx is NULL");
+		return QDF_STATUS_E_INVAL;
+	}
+
 	SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, true);
 
 	session_entry = pe_find_session_by_vdev_id(mac_ctx,