소스 검색

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 년 전
부모
커밋
cb89aac98c
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  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 */