From 9aa603578f401d94a9d4ddd8af2917f224756b3b Mon Sep 17 00:00:00 2001 From: Raja Mani Date: Thu, 4 Aug 2011 19:26:29 +0530 Subject: [PATCH] ath6kl: Fix crash during the connection process Sometimes, the network manager is failing to connect to the AP due to the below kernel crash message. The reason behind this, after issuing the connect command to the chip, the chip is sending disconnect event and then immediately one connect event to the host in some random cases. The host driver resets all states (including cfg80211 state machine) when it receives disconnect event from the chip. But, still the host driver reports the next received connect event to cfg80211, at that time cfg80211 SME state would have been in IDLE state, which was causing the below kernel crash. Now, host driver's sme state machine is checked every time before delivering connect event to cfg80211 WARNING: at net/wireless/sme.c:517 cfg80211_connect_result+0x10d/0x120() [..] Call Trace: [] warn_slowpath_common+0x72/0xa0 [] ? cfg80211_connect_result+0x10d/0x120 [] ? cfg80211_connect_result+0x10d/0x120 [] warn_slowpath_null+0x22/0x30 [] cfg80211_connect_result+0x10d/0x120 [] ath6kl_cfg80211_connect_event+0x427/0x4f0 [ath6kl] [] ? put_dec+0x2a/0xa0 [] ? number+0x365/0x380 [] ? mod_timer+0x135/0x260 [] ? format_decode+0x2fe/0x370 [] ? default_spin_lock_flags+0x8/0x10 [] ? _raw_spin_lock_irqsave+0x2f/0x50 [] ? console_unlock+0x172/0x1c0 [] ath6kl_connect_event+0x89/0x400 [ath6kl] [] ath6kl_wmi_control_rx+0x98e/0x1d60 [ath6kl] [] ? __wake_up+0x45/0x60 [] ath6kl_rx+0x56a/0x770 [ath6kl] [] ? mmc_release_host+0x22/0x40 [] ? sdio_release_host+0x19/0x30 [] ? ath6kl_sdio_read_write_sync+0x7a/0xc0 [ath6kl] [] do_rx_completion+0x41/0x50 [ath6kl] [] htc_rxmsg_pending_handler+0x6ba/0xbd0 [ath6kl] [] ? ath6kl_tx_data_cleanup+0x30/0x30 [ath6kl] [] ? ath6kl_sdio_irq_handler+0x30/0x70 [ath6kl] [] ath6kldev_intr_bh_handler+0x2a5/0x630 [ath6kl] [] ath6kl_sdio_irq_handler+0x30/0x70 [ath6kl] [] sdio_irq_thread+0xc7/0x2d0 [] ? default_wake_function+0x10/0x20 [] ? __wake_up_common+0x48/0x70 [] ? sdio_claim_irq+0x200/0x200 [] kthread+0x74/0x80 [] ? kthread_worker_fn+0x160/0x160 [] kernel_thread_helper+0x6/0x10 Signed-off-by: Raja Mani Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath6kl/cfg80211.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index dc299a6b59c..14559ffb145 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c @@ -559,14 +559,14 @@ void ath6kl_cfg80211_connect_event(struct ath6kl *ar, u16 channel, return; } - if (!test_bit(CONNECTED, &ar->flag)) { + if (ar->sme_state == SME_CONNECTING) { /* inform connect result to cfg80211 */ - ar->sme_state = SME_DISCONNECTED; + ar->sme_state = SME_CONNECTED; cfg80211_connect_result(ar->net_dev, bssid, assoc_req_ie, assoc_req_len, assoc_resp_ie, assoc_resp_len, WLAN_STATUS_SUCCESS, GFP_KERNEL); - } else { + } else if (ar->sme_state == SME_CONNECTED) { /* inform roam event to cfg80211 */ cfg80211_roamed(ar->net_dev, ibss_ch, bssid, assoc_req_ie, assoc_req_len, -- 2.41.0