소스 검색

qcacld-3.0: Check HDD context for null before retrieving the handle

Check the HDD context for null before retrieving the handle since
the HDD context is dereferenced to retrieve the handle. This
prevents a possible NULL point dereference.

Change-Id: I4837f0ce8c3d995be25c08951534e5cfa189b0bb
CRs-Fixed: 1033673
Manishekar Chandrasekaran 9 년 전
부모
커밋
79746acb37
1개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 6 6
      core/hdd/src/wlan_hdd_main.c

+ 6 - 6
core/hdd/src/wlan_hdd_main.c

@@ -5159,18 +5159,18 @@ static uint8_t hdd_get_safe_channel_from_pcl_and_acs_range(
 	hdd_context_t *hdd_ctx;
 	bool found = false;
 
-	hal_handle = WLAN_HDD_GET_HAL_CTX(adapter);
-	if (!hal_handle) {
-		hdd_err("invalid HAL handle");
-		return INVALID_CHANNEL_ID;
-	}
-
 	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	if (!hdd_ctx) {
 		hdd_err("invalid HDD context");
 		return INVALID_CHANNEL_ID;
 	}
 
+	hal_handle = WLAN_HDD_GET_HAL_CTX(adapter);
+	if (!hal_handle) {
+		hdd_err("invalid HAL handle");
+		return INVALID_CHANNEL_ID;
+	}
+
 	status = cds_get_pcl_for_existing_conn(CDS_SAP_MODE,
 			pcl.pcl_list, &pcl.pcl_len,
 			pcl.weight_list, QDF_ARRAY_SIZE(pcl.weight_list));