Browse Source

qcacmn: Add validation check at NL scan event callback

Scan event is updated to NL on a closed
wireless dev.

Add validation check at scan event callback
before updating the scan events to NL.

Change-Id: I979b53ecb481007f663feb927b6e3e96cf73616b
CRs-Fixed: 2057127
Sandeep Puligilla 7 years ago
parent
commit
0014f6238e
1 changed files with 21 additions and 0 deletions
  1. 21 0
      os_if/linux/scan/src/wlan_cfg80211_scan.c

+ 21 - 0
os_if/linux/scan/src/wlan_cfg80211_scan.c

@@ -732,6 +732,26 @@ static void wlan_cfg80211_scan_done_callback(
 		goto allow_suspend;
 	}
 
+	if (req->wdev == NULL) {
+		cfg80211_err("wirless dev is NULL,Drop scan event Id: %d",
+				 scan_id);
+		goto allow_suspend;
+	}
+
+	if (req->wdev->netdev == NULL) {
+		cfg80211_err("net dev is NULL,Drop scan event Id: %d",
+				 scan_id);
+		goto allow_suspend;
+	}
+
+	/* Make sure vdev is active */
+	status = wlan_objmgr_vdev_try_get_ref(vdev, WLAN_OSIF_ID);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		cfg80211_err("Failed to get vdev reference: scan Id: %d",
+				 scan_id);
+		goto allow_suspend;
+	}
+
 	/*
 	 * Scan can be triggred from NL or vendor scan
 	 * - If scan is triggered from NL then cfg80211 scan done should be
@@ -744,6 +764,7 @@ static void wlan_cfg80211_scan_done_callback(
 	else
 		wlan_vendor_scan_callback(req, aborted);
 
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_OSIF_ID);
 allow_suspend:
 	osif_priv = wlan_pdev_get_ospriv(pdev);
 	if (qdf_list_empty(&osif_priv->osif_scan->scan_req_q))