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
This commit is contained in:
Bjoern A. Zeeb 2023-02-18 01:15:21 +00:00
parent 17a5a29003
commit c9ba91435a

View File

@ -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);
}
/*