aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2016-06-25 13:37:44 -0500
committerKalle Valo <kvalo@codeaurora.org>2016-07-05 17:31:42 +0300
commitc3ae8ec4a26468f4b1a0b329ca9f57d19be32be8 (patch)
tree5b73a79be6a40a0b826ed8cf5202df3b309af048
parent204e2ab22e1e2d0eb7b4cb929bc4b417226474b8 (diff)
rtlwifi: rtl8192ee: Fix potential race condition
Flag rfchange_inprogress in struct rtl_ps_ctl is protected by a spinlock in most routines but not in rtl92ee_dm_watchdog(), which could lead to a race condition. The necessary locking to prevent this condition is added. Reported-by: Pavel Andrianov <andrianov@ispras.ru> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Cc: Pavel Andrianov <andrianov@ispras.ru> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c
index 459f3d0..46efba0 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c
@@ -1219,6 +1219,7 @@ void rtl92ee_dm_watchdog(struct ieee80211_hw *hw)
if (ppsc->p2p_ps_info.p2p_ps_mode)
fw_ps_awake = false;
+ spin_lock(&rtlpriv->locks.rf_ps_lock);
if ((ppsc->rfpwr_state == ERFON) &&
((!fw_current_inpsmode) && fw_ps_awake) &&
(!ppsc->rfchange_inprogress)) {
@@ -1233,4 +1234,5 @@ void rtl92ee_dm_watchdog(struct ieee80211_hw *hw)
rtl92ee_dm_dynamic_atc_switch(hw);
rtl92ee_dm_dynamic_primary_cca_ckeck(hw);
}
+ spin_unlock(&rtlpriv->locks.rf_ps_lock);
}