linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maya Erez <qca_merez@qca.qualcomm.com>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: Hamad Kadmany <QCA_hkadmany@QCA.qualcomm.com>,
	linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com,
	Maya Erez <qca_merez@qca.qualcomm.com>
Subject: [PATCH 05/11] wil6210: fix protection against connections during reset
Date: Wed,  5 Apr 2017 14:58:08 +0300	[thread overview]
Message-ID: <1491393494-11816-6-git-send-email-qca_merez@qca.qualcomm.com> (raw)
In-Reply-To: <1491393494-11816-1-git-send-email-qca_merez@qca.qualcomm.com>

From: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>

Existing code that ignores connection events during
reset flow will never take effect since it locks the
same mutex taken by the reset flow.

In addition, in case of unsolicited disconnect events ignore
those as well since device is about to get reset.

Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
---
 drivers/net/wireless/ath/wil6210/wmi.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c
index e6c249d..814c356 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -518,16 +518,16 @@ static void wmi_evt_connect(struct wil6210_priv *wil, int id, void *d, int len)
 		assoc_resp_ielen = 0;
 	}
 
-	mutex_lock(&wil->mutex);
 	if (test_bit(wil_status_resetting, wil->status) ||
 	    !test_bit(wil_status_fwready, wil->status)) {
 		wil_err(wil, "status_resetting, cancel connect event, CID %d\n",
 			evt->cid);
-		mutex_unlock(&wil->mutex);
 		/* no need for cleanup, wil_reset will do that */
 		return;
 	}
 
+	mutex_lock(&wil->mutex);
+
 	if ((wdev->iftype == NL80211_IFTYPE_STATION) ||
 	    (wdev->iftype == NL80211_IFTYPE_P2P_CLIENT)) {
 		if (!test_bit(wil_status_fwconnecting, wil->status)) {
@@ -631,6 +631,13 @@ static void wmi_evt_disconnect(struct wil6210_priv *wil, int id,
 
 	wil->sinfo_gen++;
 
+	if (test_bit(wil_status_resetting, wil->status) ||
+	    !test_bit(wil_status_fwready, wil->status)) {
+		wil_err(wil, "status_resetting, cancel disconnect event\n");
+		/* no need for cleanup, wil_reset will do that */
+		return;
+	}
+
 	mutex_lock(&wil->mutex);
 	wil6210_disconnect(wil, evt->bssid, reason_code, true);
 	mutex_unlock(&wil->mutex);
-- 
1.9.1

  parent reply	other threads:[~2017-04-05 11:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05 11:58 [PATCH 00/11] wil6210 patches Maya Erez
2017-04-05 11:58 ` [PATCH 01/11] wil6210: fix sequence for scan-abort during reset Maya Erez
2017-04-13 12:47   ` [01/11] " Kalle Valo
2017-04-05 11:58 ` [PATCH 02/11] wil6210: restore power save state after internal FW reset Maya Erez
2017-04-05 11:58 ` [PATCH 03/11] wil6210: support 8KB RX buffers Maya Erez
2017-04-05 11:58 ` [PATCH 04/11] wil6210: align to latest auto generated wmi.h Maya Erez
2017-04-05 11:58 ` Maya Erez [this message]
2017-04-05 11:58 ` [PATCH 06/11] wil6210: protect against sporadic interrupt during suspend flow Maya Erez
2017-04-05 11:58 ` [PATCH 07/11] wil6210: fix check for sparrow D0 FW file Maya Erez
2017-04-05 11:58 ` [PATCH 08/11] wil6210: fix memory access violation in wil_memcpy_from/toio_32 Maya Erez
2017-04-05 11:58 ` [PATCH 09/11] wil6210: remove HALP voting in debugfs ioblob Maya Erez
2017-04-05 11:58 ` [PATCH 10/11] wil6210: fix array out of bounds access in pmc Maya Erez
2017-04-05 11:58 ` [PATCH 11/11] wil6210: prevent access to 11AD device if resume fails Maya Erez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1491393494-11816-6-git-send-email-qca_merez@qca.qualcomm.com \
    --to=qca_merez@qca.qualcomm.com \
    --cc=QCA_hkadmany@QCA.qualcomm.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=wil6210@qca.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).