Author: avos
Date: Mon Sep 12 23:00:31 2016
New Revision: 305757
URL: https://svnweb.freebsd.org/changeset/base/305757

Log:
  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.

Modified:
  head/sys/net80211/ieee80211_adhoc.c

Modified: head/sys/net80211/ieee80211_adhoc.c
==============================================================================
--- head/sys/net80211/ieee80211_adhoc.c Mon Sep 12 22:46:19 2016        
(r305756)
+++ head/sys/net80211/ieee80211_adhoc.c Mon Sep 12 23:00:31 2016        
(r305757)
@@ -215,6 +215,19 @@ adhoc_newstate(struct ieee80211vap *vap,
                        /* 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)) {
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to