From a31fa1103b98f11de004db56e0b201702e29a97d Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Thu, 2 Aug 2018 17:35:02 -0700 Subject: [PATCH] qcacld-3.0: Validate adapter before sched scan stop wlan_hdd_cfg80211_sched_scan_stop() currently does not validate the given adapter or the hdd context. Validate both before performing a scheduled scan stop operation on said adapter. Change-Id: I4e0370ad059fbb0371a38300f33dfae7a9f8106d CRs-Fixed: 2289411 --- core/hdd/src/wlan_hdd_scan.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/core/hdd/src/wlan_hdd_scan.c b/core/hdd/src/wlan_hdd_scan.c index 94c9c18115..918b2974d5 100644 --- a/core/hdd/src/wlan_hdd_scan.c +++ b/core/hdd/src/wlan_hdd_scan.c @@ -1351,7 +1351,8 @@ int wlan_hdd_sched_scan_stop(struct net_device *dev) */ static int __wlan_hdd_cfg80211_sched_scan_stop(struct net_device *dev) { - int err; + struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); + int errno; hdd_enter_dev(dev); @@ -1377,10 +1378,19 @@ static int __wlan_hdd_cfg80211_sched_scan_stop(struct net_device *dev) return 0; } - err = wlan_hdd_sched_scan_stop(dev); + errno = hdd_validate_adapter(adapter); + if (errno) + return errno; + + errno = wlan_hdd_validate_context(WLAN_HDD_GET_CTX(adapter)); + if (errno) + return errno; + + errno = wlan_hdd_sched_scan_stop(dev); hdd_exit(); - return err; + + return errno; } #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)