From 15a7db51d2bbf6c9ed6b034c6ac9259ef6b63ad6 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Thu, 3 Aug 2017 10:27:34 +0530 Subject: [PATCH] qcacld-3.0: Reject interface up request during removal of driver During the driver unload driver de-registers the netdevices taking hdd_init_deinit_lock and if any userspace entity trying issues the interface taking the rtnl_lock resulting in the deadlock as one thread is waiting for the rtnl_lock to be released taking the hdd_init_deinit_lock and other thread is waiting for hdd_init_deinit_lock taking the rtnl_lock. Since the driver is unloading reject the interface up request before acquiring the hdd_init_deinit_lock. To address this issue do not proceed with hdd_open if unload is in progress. CRs-Fixed: 2078720 Change-Id: Ie8c8bba8d142312d3504c40a839343e16fc3b31e --- core/hdd/src/wlan_hdd_main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 7d5d683cf14b..62a6c51ad400 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -2403,6 +2403,12 @@ static int __hdd_open(struct net_device *dev) MTRACE(qdf_trace(QDF_MODULE_ID_HDD, TRACE_CODE_HDD_OPEN_REQUEST, adapter->sessionId, adapter->device_mode)); + /* Nothing to be done if device is unloading */ + if (cds_is_driver_unloading()) { + hdd_err("Driver is unloading can not open the hdd"); + return -EBUSY; + } + ret = wlan_hdd_validate_context(hdd_ctx); if (ret) return ret;