Patchwork [3.5.y.z,extended,stable] Patch "mwifiex: fix system hang issue in cmd timeout error case" has been added to staging queue

mail settings
Submitter Herton Ronaldo Krzesinski
Date Dec. 10, 2012, 2:18 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/204893/
State New
Headers show


Herton Ronaldo Krzesinski - Dec. 10, 2012, 2:18 p.m.
This is a note to let you know that I have just added a patch titled

    mwifiex: fix system hang issue in cmd timeout error case

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see



From f1aa3915cb22aab4922f1846562b3076928b268d Mon Sep 17 00:00:00 2001
From: Bing Zhao <>
Date: Thu, 15 Nov 2012 15:58:47 -0800
Subject: [PATCH] mwifiex: fix system hang issue in cmd timeout error case

commit b1a47aa5e1e159e2cb06d7dfcc17ef5149b09299 upstream.

Reported by Tim Shepard:
I was seeing sporadic failures (wedgeups), and the majority of those
failures I saw printed the printouts in mwifiex_cmd_timeout_func with
cmd = 0xe5 which is CMD_802_11_HS_CFG_ENH.  When this happens, two
minutes later I get notified that the rtcwake thread is blocked, like
      INFO: task rtcwake:3495 blocked for more than 120 seconds.

To get the hung thread unblocked we wake up the cmd wait queue and
cancel the ioctl.

Reported-by: Tim Shepard <>
Signed-off-by: Bing Zhao <>
Signed-off-by: John W. Linville <>
Signed-off-by: Herton Ronaldo Krzesinski <>
 drivers/net/wireless/mwifiex/cmdevt.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)



diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index 51e023e..fc3b6f4 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -873,9 +873,6 @@  mwifiex_cmd_timeout_func(unsigned long function_context)
 	cmd_node = adapter->curr_cmd;
-	if (cmd_node->wait_q_enabled)
-		adapter->cmd_wait_q.status = -ETIMEDOUT;
 	if (cmd_node) {
 		adapter->dbg.timeout_cmd_id =
@@ -921,6 +918,14 @@  mwifiex_cmd_timeout_func(unsigned long function_context)

 		dev_err(adapter->dev, "ps_mode=%d ps_state=%d\n",
 			adapter->ps_mode, adapter->ps_state);
+		if (cmd_node->wait_q_enabled) {
+			adapter->cmd_wait_q.status = -ETIMEDOUT;
+			wake_up_interruptible(&adapter->cmd_wait_q.wait);
+			mwifiex_cancel_pending_ioctl(adapter);
+			/* reset cmd_sent flag to unblock new commands */
+			adapter->cmd_sent = false;
+		}
 	if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING)