git: c9ba91435a01 - main - net80211: ieee80211_swscan_bg_scan() track return variable under lock
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 Feb 2023 21:14:07 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=c9ba91435a01a80632a5b68144d75b38241fc8be
commit c9ba91435a01a80632a5b68144d75b38241fc8be
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-02-18 01:15:21 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-02-23 21:12:23 +0000
net80211: ieee80211_swscan_bg_scan() track return variable under lock
As the comment says it probably does not matter but use a local
variable to track state under lock so we can return the last known
good state of what we thought we were operating under after unlocking.
Likely no functional changes.
Sponsored by: The FreeBSD Foundation
MFC atfer: 3 days
Reviewed by: enweiwu, adrian
Differential Revision: https://reviews.freebsd.org/D38660
---
sys/net80211/ieee80211_scan_sw.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sys/net80211/ieee80211_scan_sw.c b/sys/net80211/ieee80211_scan_sw.c
index 1456fafd60a1..51e1189824e3 100644
--- a/sys/net80211/ieee80211_scan_sw.c
+++ b/sys/net80211/ieee80211_scan_sw.c
@@ -336,12 +336,14 @@ ieee80211_swscan_bg_scan(const struct ieee80211_scanner *scan,
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_scan_state *ss = ic->ic_scan;
+ bool scanning;
/* XXX assert unlocked? */
// IEEE80211_UNLOCK_ASSERT(ic);
IEEE80211_LOCK(ic);
- if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) {
+ scanning = ic->ic_flags & IEEE80211_F_SCAN;
+ if (!scanning) {
u_int duration;
/*
* Go off-channel for a fixed interval that is large
@@ -405,6 +407,7 @@ ieee80211_swscan_bg_scan(const struct ieee80211_scanner *scan,
ic->ic_flags_ext |= IEEE80211_FEXT_BGSCAN;
ieee80211_runtask(ic,
&SCAN_PRIVATE(ss)->ss_scan_start);
+ scanning = true;
} else {
/* XXX msg+stat */
}
@@ -415,8 +418,7 @@ ieee80211_swscan_bg_scan(const struct ieee80211_scanner *scan,
}
IEEE80211_UNLOCK(ic);
- /* NB: racey, does it matter? */
- return (ic->ic_flags & IEEE80211_F_SCAN);
+ return (scanning);
}
/*