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
diff --git a/core/hdd/src/wlan_hdd_scan.c b/core/hdd/src/wlan_hdd_scan.c
index 2804c59..586c50f 100644
--- a/core/hdd/src/wlan_hdd_scan.c
+++ b/core/hdd/src/wlan_hdd_scan.c
@@ -1192,15 +1192,23 @@
 {
 	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;
+	}
 }
 
 /**