Commit b819447d authored by Hamad Kadmany's avatar Hamad Kadmany Committed by Kalle Valo

wil6210: fix protection against connections during reset

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: default avatarHamad Kadmany <qca_hkadmany@qca.qualcomm.com>
Signed-off-by: default avatarMaya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 90ffabb0
...@@ -518,16 +518,16 @@ static void wmi_evt_connect(struct wil6210_priv *wil, int id, void *d, int len) ...@@ -518,16 +518,16 @@ static void wmi_evt_connect(struct wil6210_priv *wil, int id, void *d, int len)
assoc_resp_ielen = 0; assoc_resp_ielen = 0;
} }
mutex_lock(&wil->mutex);
if (test_bit(wil_status_resetting, wil->status) || if (test_bit(wil_status_resetting, wil->status) ||
!test_bit(wil_status_fwready, wil->status)) { !test_bit(wil_status_fwready, wil->status)) {
wil_err(wil, "status_resetting, cancel connect event, CID %d\n", wil_err(wil, "status_resetting, cancel connect event, CID %d\n",
evt->cid); evt->cid);
mutex_unlock(&wil->mutex);
/* no need for cleanup, wil_reset will do that */ /* no need for cleanup, wil_reset will do that */
return; return;
} }
mutex_lock(&wil->mutex);
if ((wdev->iftype == NL80211_IFTYPE_STATION) || if ((wdev->iftype == NL80211_IFTYPE_STATION) ||
(wdev->iftype == NL80211_IFTYPE_P2P_CLIENT)) { (wdev->iftype == NL80211_IFTYPE_P2P_CLIENT)) {
if (!test_bit(wil_status_fwconnecting, wil->status)) { if (!test_bit(wil_status_fwconnecting, wil->status)) {
...@@ -631,6 +631,13 @@ static void wmi_evt_disconnect(struct wil6210_priv *wil, int id, ...@@ -631,6 +631,13 @@ static void wmi_evt_disconnect(struct wil6210_priv *wil, int id,
wil->sinfo_gen++; 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); mutex_lock(&wil->mutex);
wil6210_disconnect(wil, evt->bssid, reason_code, true); wil6210_disconnect(wil, evt->bssid, reason_code, true);
mutex_unlock(&wil->mutex); mutex_unlock(&wil->mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment