Patch "mac80211: always wind down STA state" has been added to the 4.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    mac80211: always wind down STA state

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mac80211-always-wind-down-sta-state.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2e39c206d0aa7ccf9288a5787c71fc83589cd499
Author: Johannes Berg <johannes.berg@xxxxxxxxx>
Date:   Fri Oct 9 14:17:11 2020 +0200

    mac80211: always wind down STA state
    
    [ Upstream commit dcd479e10a0510522a5d88b29b8f79ea3467d501 ]
    
    When (for example) an IBSS station is pre-moved to AUTHORIZED
    before it's inserted, and then the insertion fails, we don't
    clean up the fast RX/TX states that might already have been
    created, since we don't go through all the state transitions
    again on the way down.
    
    Do that, if it hasn't been done already, when the station is
    freed. I considered only freeing the fast TX/RX state there,
    but we might add more state so it's more robust to wind down
    the state properly.
    
    Note that we warn if the station was ever inserted, it should
    have been properly cleaned up in that case, and the driver
    will probably not like things happening out of order.
    
    Reported-by: syzbot+2e293dbd67de2836ba42@xxxxxxxxxxxxxxxxxxxxxxxxx
    Link: https://lore.kernel.org/r/20201009141710.7223b322a955.I95bd08b9ad0e039c034927cce0b75beea38e059b@changeid
    Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index bbddab248c489..6f7c3f6a5027b 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -242,6 +242,24 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
  */
 void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
 {
+	/*
+	 * If we had used sta_info_pre_move_state() then we might not
+	 * have gone through the state transitions down again, so do
+	 * it here now (and warn if it's inserted).
+	 *
+	 * This will clear state such as fast TX/RX that may have been
+	 * allocated during state transitions.
+	 */
+	while (sta->sta_state > IEEE80211_STA_NONE) {
+		int ret;
+
+		WARN_ON_ONCE(test_sta_flag(sta, WLAN_STA_INSERTED));
+
+		ret = sta_info_move_state(sta, sta->sta_state - 1);
+		if (WARN_ONCE(ret, "sta_info_move_state() returned %d\n", ret))
+			break;
+	}
+
 	if (sta->rate_ctrl)
 		rate_control_free_sta(sta);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux