net80211: fix possible panic in adhoc mode (INIT -> RUN state transition).

In case if there is already running interface, a second non-sta
interface will omit scanning, going directly to RUN state. Handle
this case for adhoc mode appropriately.

Tested with RTL8821AU, 2 vaps in IBSS mode.
This commit is contained in:
Andriy Voskoboinyk 2016-09-12 23:00:31 +00:00
parent 6e70b4f058
commit 04a5c73b30
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=305757

View File

@ -215,6 +215,19 @@ adhoc_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
/* XXX validate prerequisites */
}
switch (ostate) {
case IEEE80211_S_INIT:
/*
* Already have a channel; bypass the
* scan and startup immediately.
* Note that ieee80211_create_ibss will call
* back to do a RUN->RUN state change.
*/
ieee80211_create_ibss(vap,
ieee80211_ht_adjust_channel(ic,
ic->ic_curchan, vap->iv_flags_ht));
/* NB: iv_bss is changed on return */
ni = vap->iv_bss;
break;
case IEEE80211_S_SCAN:
#ifdef IEEE80211_DEBUG
if (ieee80211_msg_debug(vap)) {