Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src-draft/trunk]: src/sys/net80211 Locking fixes.



details:   https://anonhg.NetBSD.org/src-all/rev/61ee1c9f5742
branches:  trunk
changeset: 988721:61ee1c9f5742
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Fri May 08 07:10:48 2020 +1000

description:
Locking fixes.
Avoid a state machine override.
Handle hw_init and ieee80211_init differently.

diffstat:

 sys/net80211/ieee80211_ioctl.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (58 lines):

diff -r e69ba10062da -r 61ee1c9f5742 sys/net80211/ieee80211_ioctl.c
--- a/sys/net80211/ieee80211_ioctl.c    Fri May 08 07:09:14 2020 +1000
+++ b/sys/net80211/ieee80211_ioctl.c    Fri May 08 07:10:48 2020 +1000
@@ -1567,7 +1567,7 @@
                case IEEE80211_M_STA:
                        mlmedebug(vap, vap->iv_bss->ni_macaddr, op, reason);
                        /* XXX not quite right */
-                       ieee80211_new_state(vap, IEEE80211_S_INIT, reason);
+               //      ieee80211_new_state(vap, IEEE80211_S_INIT, reason);
                        break;
                case IEEE80211_M_HOSTAP:
                        mlmeop.vap = vap;
@@ -1730,7 +1730,10 @@
        if (lookup.se == NULL)
                return ENOENT;
        mlmedebug(vap, mac, IEEE80211_MLME_ASSOC, 0);
-       if (!ieee80211_sta_join(vap, lookup.se->se_chan, lookup.se))
+       IEEE80211_LOCK(vap->iv_ic);
+       int result = ieee80211_sta_join(vap, lookup.se->se_chan, lookup.se);
+       IEEE80211_UNLOCK(vap->iv_ic);
+       if (!result)
                return EIO;             /* XXX unique but could be better */
        return 0;
 }
@@ -2737,7 +2740,6 @@
                ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
        } else {
                vap->iv_flags_ext &= ~IEEE80211_FEXT_SCANREQ;
-               IEEE80211_UNLOCK(ic);
                if (sr->sr_flags & IEEE80211_IOC_SCAN_CHECK) {
                        error = ieee80211_check_scan(vap, sr->sr_flags,
                            sr->sr_duration, sr->sr_mindwell, sr->sr_maxdwell,
@@ -2751,6 +2753,7 @@
                            /* NB: cheat, we assume structures are compatible */
                            (const struct ieee80211_scan_ssid *) &sr->sr_ssid[0]);
                }
+               IEEE80211_UNLOCK(ic);
                if (error == 0)
                        return EINPROGRESS;
        }
@@ -3637,14 +3640,14 @@
                    vap->iv_reset(vap, ireq->i_type) : 0;
        if (error == ENETRESET) {
                /* XXX need to re-think AUTO handling */
+               if (IS_UP_AUTO(vap))
 #if __FreeBSD__
-               if (IS_UP_AUTO(vap))
                        ieee80211_init(vap);
-               error = 0;
-#elif 0
+#elif __NetBSD__
                        /* arg is a vap in 802.11 code */ 
                        ieee80211_init((struct ifnet *)vap);
 #endif
+               error = 0;
        }
        return error;
 }



Home | Main Index | Thread Index | Old Index