madwifi: fix a locking error related to wds (thx, tharvey)
authorFelix Fietkau <nbd@openwrt.org>
Mon, 23 Mar 2009 12:17:46 +0000 (12:17 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 23 Mar 2009 12:17:46 +0000 (12:17 +0000)
SVN-Revision: 14990

package/madwifi/patches/370-wdsvap.patch

index f72e22ffe91edb06a23f6cf365877dff0e4d3782..38093d6c42af10496e283f28064cc70a64c15cd8 100644 (file)
 +                               (vap->iv_opmode == IEEE80211_M_WDS)) &&
 +                              (scan.capinfo & IEEE80211_CAPINFO_ESS))) {
 +                      struct ieee80211vap *avp = NULL;
++                      int found = 0;
 +
 +                      IEEE80211_LOCK_IRQ(vap->iv_ic);
 +                      if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
-+                              int found = 0;
-+
 +                              TAILQ_FOREACH(avp, &vap->iv_wdslinks, iv_wdsnext) {
 +                                      if (!memcmp(avp->wds_mac, wh->i_addr2, IEEE80211_ADDR_LEN)) {
 +                                              if (avp->iv_state != IEEE80211_S_RUN)
 +                                              break;
 +                                      }
 +                              }
-+                              if (!found)
-+                                      break;
-+
-+                              ni = ni_or_null = avp->iv_wdsnode;
++                              if (found)
++                                      ni = ni_or_null = avp->iv_wdsnode;
 +                      } else if (vap->iv_opmode == IEEE80211_M_WDS) {
++                              found = 1;
 +                              ni = ni_or_null = vap->iv_wdsnode;
 +                      }
 +                      IEEE80211_UNLOCK_IRQ(vap->iv_ic);
 +
++                      if (!found)
++                              break;
 +
                        if (ni_or_null == NULL) {
 -                              /* Create a new entry in the neighbor table. */