From a3148e6ca8df0a76e98c69869f2a277db877034c Mon Sep 17 00:00:00 2001 From: Hanumanth Reddy Pothula Date: Fri, 10 Feb 2017 19:32:35 +0530 Subject: qcacld-3.0: Don't process stop_adapter twice During driver unload, stop_adapter is called for all interfaces without checking DEVICE_IFACE_OPENED flag value. This may lead stop_adapter to be called twice, if interface down is done before driver unload. To mitigate this issue, process stop_adapter only when DEVICE_IFACE_OPENED flag is set. Change-Id: Ibbcc138ae7dd4ac9153043c7f61363d6ecb8daca CRs-Fixed: 2003411 --- core/hdd/src/wlan_hdd_hostapd.c | 5 ----- core/hdd/src/wlan_hdd_main.c | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 7d27f5d51234..19c99cbd4fcd 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -311,11 +311,6 @@ static int __hdd_hostapd_stop(struct net_device *dev) return -ENODEV; } - if (!test_bit(DEVICE_IFACE_OPENED, &adapter->event_flags)) { - hdd_info("iface is not in open state, flags: %lu", - adapter->event_flags); - return 0; - } if (!sap_ctx) { hdd_err("invalid sap ctx : %p", sap_ctx); return -ENODEV; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 02e77cc87a7e..ad3fe67d5c59 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -3606,6 +3606,12 @@ QDF_STATUS hdd_stop_adapter(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter, ENTER(); + if (!test_bit(DEVICE_IFACE_OPENED, &adapter->event_flags)) { + hdd_info("interface %d is not up %lu", + adapter->device_mode, adapter->event_flags); + return -ENODEV; + } + scan_info = &adapter->scan_info; hdd_notice("Disabling queues"); wlan_hdd_netif_queue_control(adapter, WLAN_NETIF_TX_DISABLE_N_CARRIER, -- cgit v1.2.3