summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2010-04-23 10:28:19 +0530
committerJohn W. Linville <linville@tuxdriver.com>2010-04-26 14:21:21 -0400
commit0d36d71da2a3e5b28b4e7743c0041515cca798ef (patch)
tree7ff0d830e72a4a15ffe05b17f3afa0987448466e /drivers/net/wireless/ath/ath9k
parentba44370175d2e743065382508ed7823cc83cea0a (diff)
ath9k_htc: Fix WMI command race
My patch "ath9k_htc: Handle WMI timeouts properly" introduced a race condition in WMI command processing. The last issued command should be stored _before_ issuing a WMI command. Not doing this would result in the WMI event IRQ dropping correct command responses as invalid. Fix this race by storing the command id correctly. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k')
-rw-r--r--drivers/net/wireless/ath/ath9k/wmi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c
index c6885453265..e23172c9caa 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.c
+++ b/drivers/net/wireless/ath/ath9k/wmi.c
@@ -305,14 +305,14 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,
wmi->cmd_rsp_buf = rsp_buf;
wmi->cmd_rsp_len = rsp_len;
- ret = ath9k_wmi_cmd_issue(wmi, skb, cmd_id, cmd_len);
- if (ret)
- goto out;
-
spin_lock_irqsave(&wmi->wmi_lock, flags);
wmi->last_cmd_id = cmd_id;
spin_unlock_irqrestore(&wmi->wmi_lock, flags);
+ ret = ath9k_wmi_cmd_issue(wmi, skb, cmd_id, cmd_len);
+ if (ret)
+ goto out;
+
time_left = wait_for_completion_timeout(&wmi->cmd_wait, timeout);
if (!time_left) {
ath_print(common, ATH_DBG_WMI,