Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 5.9 099/255] mac80211: always wind down STA state
  2020-11-17 13:02 [PATCH 5.9 000/255] 5.9.9-rc1 review Greg Kroah-Hartman
@ 2020-11-17 13:03 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2020-11-17 13:03 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, syzbot+2e293dbd67de2836ba42,
	Johannes Berg, Sasha Levin

From: Johannes Berg <johannes.berg@intel.com>

[ 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@syzkaller.appspotmail.com
Link: https://lore.kernel.org/r/20201009141710.7223b322a955.I95bd08b9ad0e039c034927cce0b75beea38e059b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/mac80211/sta_info.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index fb4f2b9b294f0..4fe284ff1ea3d 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -258,6 +258,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);
 
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 5.9 099/255] mac80211: always wind down STA state
@ 2020-11-19  3:30 Richard Narron
  2020-11-19 11:38 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Narron @ 2020-11-19  3:30 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Greg KH, Sasha Levin, stable

This patch is 5.9.9-rc1 but is missing from the new 5.9.9 on kernel.org.

Is this desirable?

https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.9.9-rc1.xz

https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/incr/patch-5.9.8-9.xz

I like to compare the stable review and incremental patches and if they
are substantially the same then I just keep using the stable review
version...

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 5.9 099/255] mac80211: always wind down STA state
  2020-11-19  3:30 [PATCH 5.9 099/255] mac80211: always wind down STA state Richard Narron
@ 2020-11-19 11:38 ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2020-11-19 11:38 UTC (permalink / raw)
  To: Richard Narron; +Cc: Johannes Berg, Sasha Levin, stable

On Wed, Nov 18, 2020 at 07:30:25PM -0800, Richard Narron wrote:
> This patch is 5.9.9-rc1 but is missing from the new 5.9.9 on kernel.org.
> 
> Is this desirable?

Yes, please see the email thread on the mailing list about why it was
removed.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-19 11:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-19  3:30 [PATCH 5.9 099/255] mac80211: always wind down STA state Richard Narron
2020-11-19 11:38 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2020-11-17 13:02 [PATCH 5.9 000/255] 5.9.9-rc1 review Greg Kroah-Hartman
2020-11-17 13:03 ` [PATCH 5.9 099/255] mac80211: always wind down STA state Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox