Browse Source

qcacld-3.0: Check vdev and sync_ind ptr before access

Add NULL check for vdev in hdd_stop_sap_set_tx_power and
sync_ind NULL check in cm_roam_sync_event_handler.

Change-Id: I1a760cdd17975403f48b75459ecb5ea9ac3e9d77
CRs-Fixed: 3144140
Liangwei Dong 3 years ago
parent
commit
a92b03d325

+ 5 - 1
components/umac/mlme/connection_mgr/core/src/wlan_cm_roam_offload_event.c

@@ -361,7 +361,11 @@ cm_roam_sync_event_handler(struct wlan_objmgr_psoc *psoc,
 			   uint32_t len,
 			   struct roam_offload_synch_ind *sync_ind)
 {
-	if (sync_ind && sync_ind->hw_mode_trans_present)
+	if (!sync_ind) {
+		mlme_err("invalid sync_ind");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+	if (sync_ind->hw_mode_trans_present)
 		cm_handle_roam_sync_update_hw_mode(
 			&sync_ind->hw_mode_trans_ind);
 

+ 4 - 1
core/hdd/src/wlan_hdd_hostapd.c

@@ -3398,7 +3398,7 @@ void hdd_stop_sap_set_tx_power(struct wlan_objmgr_psoc *psoc,
 {
 	struct wlan_objmgr_vdev *vdev =
 		hdd_objmgr_get_vdev_by_user(adapter, WLAN_OSIF_ID);
-	struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(vdev);
+	struct wlan_objmgr_pdev *pdev;
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	struct qdf_mac_addr bssid;
 	struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
@@ -3410,6 +3410,9 @@ void hdd_stop_sap_set_tx_power(struct wlan_objmgr_psoc *psoc,
 	uint32_t chan_freq;
 	bool is_valid_txpower = false;
 
+	if (!vdev)
+		return;
+	pdev = wlan_vdev_get_pdev(vdev);
 	hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_ID);
 
 	psoc_priv_obj = reg_get_psoc_obj(psoc);