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
This commit is contained in:
Ashish
2022-01-17 13:30:32 +05:30
committed by Madan Koyyalamudi
parent af3885dcdb
commit 5fe88ada0a

View File

@@ -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;
}