From 5fe88ada0a0eb9892f49c68ea844cb85f032d410 Mon Sep 17 00:00:00 2001 From: Ashish Date: Mon, 17 Jan 2022 13:30:32 +0530 Subject: [PATCH] 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 --- os_if/linux/scan/src/wlan_cfg80211_scan.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/os_if/linux/scan/src/wlan_cfg80211_scan.c b/os_if/linux/scan/src/wlan_cfg80211_scan.c index 1f00f0287e..8b0b32d8e6 100644 --- a/os_if/linux/scan/src/wlan_cfg80211_scan.c +++ b/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; }