浏览代码

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 年之前
父节点
当前提交
06adf26974
共有 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;
+	}
 }
 
 /**