소스 검색

qcacld-3.0: Prevent null data access

qcacld-2.0 to qcacld-3.0 propagation

In DFS mode, scan req completed through work item
which is async method and may lead to null
pointer access during driver unload.
So as part of fix null check are put in place
to avoid null data access.

Change-Id: I1f2255c1ad6e3e881626a32384b9badde1b255fc
CRs-Fixed: 894741
Mukul Sharma 9 년 전
부모
커밋
99828e23c8
1개의 변경된 파일15개의 추가작업 그리고 7개의 파일을 삭제
  1. 15 7
      core/hdd/src/wlan_hdd_scan.c

+ 15 - 7
core/hdd/src/wlan_hdd_scan.c

@@ -1192,15 +1192,23 @@ static void wlan_hdd_cfg80211_scan_block_cb(struct work_struct *work)
 {
 	hdd_adapter_t *adapter = container_of(work,
 					      hdd_adapter_t, scan_block_work);
-	struct cfg80211_scan_request *request = adapter->request;
+	struct cfg80211_scan_request *request;
+	if (WLAN_HDD_ADAPTER_MAGIC != adapter->magic) {
+		hddLog(LOGE,
+			"%s: HDD adapter context is invalid", __func__);
+		return;
+	}
 
-	request->n_ssids = 0;
-	request->n_channels = 0;
+	request = adapter->request;
+	if (request) {
+		request->n_ssids = 0;
+		request->n_channels = 0;
 
-	hddLog(LOGE,
-		FL("##In DFS Master mode. Scan aborted. Null result sent"));
-	cfg80211_scan_done(request, true);
-	adapter->request = NULL;
+		hddLog(LOGE,
+		   FL("##In DFS Master mode. Scan aborted. Null result sent"));
+		cfg80211_scan_done(request, true);
+		adapter->request = NULL;
+	}
 }
 
 /**