Преглед изворни кода

qcacmn: Free scan request if netdev is NULL or get vdev ref fails

Currently driver just cancels the scan request and does not free
scan request memory if netdev is NULL or get vdev ref fails,
which leads to memleak.

To address abobve issue, free the scan request if netdev is NULL
or if get vdev ref fails.

Change-Id: Id6605e76a8c0977df93428f2aeb73c0bdfb84685
CRs-Fixed: 3107784
Ashish пре 3 година
родитељ
комит
5fe88ada0a
1 измењених фајлова са 12 додато и 0 уклоњено
  1. 12 0
      os_if/linux/scan/src/wlan_cfg80211_scan.c

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

@@ -1056,6 +1056,12 @@ static void wlan_cfg80211_scan_done_callback(
 
 	if (!netdev) {
 		osif_err("net dev is NULL,Drop scan event Id: %d", scan_id);
+		/*
+		 * Free scan request in case of VENDOR_SCAN as it is
+		 * allocated in driver.
+		 */
+		if (source == VENDOR_SCAN)
+			qdf_mem_free(req);
 		goto allow_suspend;
 	}
 
@@ -1063,6 +1069,12 @@ static void wlan_cfg80211_scan_done_callback(
 	status = wlan_objmgr_vdev_try_get_ref(vdev, WLAN_OSIF_ID);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		osif_err("Failed to get vdev reference: scan Id: %d", scan_id);
+		/*
+		 * Free scan request in case of VENDOR_SCAN as it is
+		 * allocated in driver.
+		 */
+		if (source == VENDOR_SCAN)
+			qdf_mem_free(req);
 		goto allow_suspend;
 	}