mac80211: Fix potential endless loop
[openwrt/staging/wigyori.git] / package / kernel / mac80211 / patches / subsys / 370-mac80211-fix-misplaced-while-instead-of-if.patch
1 From 5981fe5b0529ba25d95f37d7faa434183ad618c5 Mon Sep 17 00:00:00 2001
2 From: Johannes Berg <johannes.berg@intel.com>
3 Date: Mon, 3 Aug 2020 11:02:10 +0200
4 Subject: [PATCH] mac80211: fix misplaced while instead of if
5
6 This never was intended to be a 'while' loop, it should've
7 just been an 'if' instead of 'while'. Fix this.
8
9 I noticed this while applying another patch from Ben that
10 intended to fix a busy loop at this spot.
11
12 Cc: stable@vger.kernel.org
13 Fixes: b16798f5b907 ("mac80211: mark station unauthorized before key removal")
14 Reported-by: Ben Greear <greearb@candelatech.com>
15 Link: https://lore.kernel.org/r/20200803110209.253009ae41ff.I3522aad099392b31d5cf2dcca34cbac7e5832dde@changeid
16 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 ---
18 net/mac80211/sta_info.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21 --- a/net/mac80211/sta_info.c
22 +++ b/net/mac80211/sta_info.c
23 @@ -1051,7 +1051,7 @@ static void __sta_info_destroy_part2(str
24 might_sleep();
25 lockdep_assert_held(&local->sta_mtx);
26
27 - while (sta->sta_state == IEEE80211_STA_AUTHORIZED) {
28 + if (sta->sta_state == IEEE80211_STA_AUTHORIZED) {
29 ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC);
30 WARN_ON_ONCE(ret);
31 }