Jelajahi Sumber

qcacmn: Add check for max pdev id on pdev search

Max pdev count check is performed before accessing the pdev list index

Change-Id: I755a5cb595824968b057321b13a6e1c837ece669
CRs-Fixed: 2177109
Srinivas Pitla 7 tahun lalu
induk
melakukan
cb89aac98c
1 mengubah file dengan 8 tambahan dan 0 penghapusan
  1. 8 0
      umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c

+ 8 - 0
umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c

@@ -760,6 +760,10 @@ struct wlan_objmgr_pdev *wlan_objmgr_get_pdev_by_id(
 	struct wlan_objmgr_psoc_objmgr *objmgr;
 	struct wlan_objmgr_pdev *pdev = NULL;
 
+	/* If id is invalid, return */
+	if (id >= WLAN_UMAC_MAX_PDEVS)
+		return NULL;
+
 	wlan_psoc_obj_lock(psoc);
 	objmgr = &psoc->soc_objmgr;
 	/* get pdev from pdev list */
@@ -784,6 +788,10 @@ struct wlan_objmgr_pdev *wlan_objmgr_get_pdev_by_id_no_state(
 	struct wlan_objmgr_psoc_objmgr *objmgr;
 	struct wlan_objmgr_pdev *pdev = NULL;
 
+	/* If id is invalid, return */
+	if (id >= WLAN_UMAC_MAX_PDEVS)
+		return NULL;
+
 	wlan_psoc_obj_lock(psoc);
 	objmgr = &psoc->soc_objmgr;
 	/* get pdev from pdev list */