Browse Source

qcacld-3.0: Fix null ptr dereference in wma_print_wow_stats

wma_print_wow_stats does not do null validation for pointer vdev
returned from call to function wlan_objmgr_get_vdev_by_id_from_psoc
which can lead to null pointer derefrence.

Add NULL pointer check for vdev in wma_print_wow_stats.

Change-Id: I4fae47b303436bf9f2a4768995cea7640bc6feab
CRs-Fixed: 2564073
Abhinav Kumar 5 years ago
parent
commit
9ff4490dcc
1 changed files with 6 additions and 0 deletions
  1. 6 0
      core/wma/src/wma_features.c

+ 6 - 0
core/wma/src/wma_features.c

@@ -1553,6 +1553,12 @@ static void wma_print_wow_stats(t_wma_handle *wma,
 	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(wma->psoc,
 						    wake_info->vdev_id,
 						    WLAN_LEGACY_WMA_ID);
+	if (!vdev) {
+		WMA_LOGE("%s, vdev_id: %d, failed to get vdev from psoc",
+			 __func__, wake_info->vdev_id);
+		return;
+	}
+
 	ucfg_mc_cp_stats_get_vdev_wake_lock_stats(vdev, &stats);
 	wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_WMA_ID);
 	wma_wow_stats_display(&stats);