Kaynağa Gözat

qcacmn: Avoid assigning NULL to double pointer

Currently infra_cp_stats_req_context of psoc
cp object is assigned to **context which may
cause issue when infra_cp_stats_req_context
is NULL because without allocating memory to
**context, *context is being accessed.

Fix is to validate infra_cp_stats_req_context
and assign only if context is not NULL.

Change-Id: I8281bd77a0b829fbfc6b25ba2ad688236bc75623
CRs-Fixed: 3575882
Sheenam Monga 1 yıl önce
ebeveyn
işleme
2ae076f0e6

+ 4 - 2
umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c

@@ -439,8 +439,10 @@ wlan_cp_stats_infra_cp_get_context(struct wlan_objmgr_psoc *psoc,
 	}
 
 	wlan_cp_stats_psoc_obj_lock(psoc_cp_stats_priv);
-	*resp_cb = psoc_cp_stats_priv->get_infra_cp_stats;
-	*context = psoc_cp_stats_priv->infra_cp_stats_req_context;
+	if (psoc_cp_stats_priv->get_infra_cp_stats)
+		*resp_cb = psoc_cp_stats_priv->get_infra_cp_stats;
+	if (psoc_cp_stats_priv->infra_cp_stats_req_context)
+		*context = psoc_cp_stats_priv->infra_cp_stats_req_context;
 	wlan_cp_stats_psoc_obj_unlock(psoc_cp_stats_priv);
 
 	return QDF_STATUS_SUCCESS;