From 53e12d03fb251ce25dc836957deed4fe496f4b89 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Wed, 1 Feb 2017 17:43:03 -0800 Subject: qcacld-3.0: Reject Stop AP call if module is closed Under situations where the driver detects wifi capabilities are not being used, it cleans itself up transparently to the kernel and shuts down. The kernel has been observed calling the stop AP callback in these situations, even though no virtual devices are active, which causes a crash. Gracefully reject the calls into stop AP by the kernel in such cases. Change-Id: Ic215b033526125412ebe12c0021c61b20f4c86a1 CRs-Fixed: 2001200 --- core/hdd/src/wlan_hdd_hostapd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 78c9df6f9e20..a24bc1221d6e 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -7800,7 +7800,7 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev) { hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); - hdd_context_t *pHddCtx = NULL; + hdd_context_t *pHddCtx = wiphy_priv(wiphy); hdd_scaninfo_t *pScanInfo = NULL; hdd_adapter_t *staAdapter = NULL; QDF_STATUS status = QDF_STATUS_E_FAILURE; @@ -7819,6 +7819,11 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, return -EINVAL; } + if (pHddCtx->driver_status == DRIVER_MODULES_CLOSED) { + hdd_err("Driver module is closed; dropping request"); + return -EINVAL; + } + if (wlan_hdd_validate_session_id(pAdapter->sessionId)) { hdd_err("invalid session id: %d", pAdapter->sessionId); return -EINVAL; @@ -7837,7 +7842,6 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, hdd_device_mode_to_string(pAdapter->device_mode), pAdapter->device_mode); - pHddCtx = WLAN_HDD_GET_CTX(pAdapter); ret = wlan_hdd_validate_context(pHddCtx); if (0 != ret) return ret; -- cgit v1.2.3