madwifi: fix some potential null pointer derefs with wds
authorFelix Fietkau <nbd@openwrt.org>
Sun, 24 Jan 2010 23:39:00 +0000 (23:39 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 24 Jan 2010 23:39:00 +0000 (23:39 +0000)
SVN-Revision: 19322

package/madwifi/patches/370-wdsvap.patch
package/madwifi/patches/387-maxassoc.patch
package/madwifi/patches/390-frame_type.patch
package/madwifi/patches/393-mbss_vap_auth.patch
package/madwifi/patches/394-probereq.patch
package/madwifi/patches/441-fix_ibss_node_handling.patch
package/madwifi/patches/451-ibss_race_fix.patch

index 9da13a6c5c7bdb2aea3f49a624eb523fcd4cebf7..e507afb25d65bae7e67ff24530c42dd6d5e75220 100644 (file)
                        vap->iv_stats.is_rx_mgtdiscard++;
                        return;
                }
-@@ -3471,13 +3519,54 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+@@ -3471,13 +3519,56 @@ ieee80211_recv_mgmt(struct ieee80211vap 
                 */
                if (ic->ic_flags & IEEE80211_F_SCAN) {
                        ieee80211_add_scan(vap, &scan, wh, subtype, rssi, rtsf);
 +                                      if (!memcmp(avp->wds_mac, wh->i_addr2, IEEE80211_ADDR_LEN)) {
 +                                              if (avp->iv_state != IEEE80211_S_RUN)
 +                                                      continue;
++                                              if (!avp->iv_wdsnode)
++                                                      continue;
 +                                              found = 1;
 +                                              break;
 +                                      }
 +                              }
 +                              if (found)
 +                                      ni = ni_or_null = avp->iv_wdsnode;
-+                      } else if (vap->iv_opmode == IEEE80211_M_WDS) {
++                      } else if ((vap->iv_opmode == IEEE80211_M_WDS) && vap->iv_wdsnode) {
 +                              found = 1;
 +                              ni = ni_or_null = vap->iv_wdsnode;
 +                      }
                        } else {
                                /*
                                 * Copy data from beacon to neighbor table.
-@@ -3490,6 +3579,7 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+@@ -3490,6 +3581,7 @@ ieee80211_recv_mgmt(struct ieee80211vap 
                                IEEE80211_ADDR_COPY(ni->ni_bssid, wh->i_addr3);
                                memcpy(ni->ni_tstamp.data, scan.tstamp,
                                        sizeof(ni->ni_tstamp));
index d74419bdb055e6f402566b14d5ca2e65e88cf475..df2b7fd1f23d7834211dd89f04764b05369a43c2 100644 (file)
@@ -56,7 +56,7 @@
        /*
 --- a/net80211/ieee80211_input.c
 +++ b/net80211/ieee80211_input.c
-@@ -4018,7 +4018,26 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+@@ -4020,7 +4020,26 @@ ieee80211_recv_mgmt(struct ieee80211vap 
                        vap->iv_stats.is_rx_assoc_norate++;
                        return;
                }
index caad49c3d3fc8f335bf60083d7de5c58d7e78b51..0987f7c5df2142ec10e69718bb881f6e1200f3d9 100644 (file)
@@ -1,6 +1,6 @@
 --- a/net80211/ieee80211_input.c
 +++ b/net80211/ieee80211_input.c
-@@ -4441,7 +4441,9 @@ ath_eth_type_trans(struct sk_buff *skb, 
+@@ -4443,7 +4443,9 @@ ath_eth_type_trans(struct sk_buff *skb, 
                if (memcmp(eth->h_dest, dev->dev_addr, ETH_ALEN))
                        skb->pkt_type = PACKET_OTHERHOST;
  
index 71e11fa39a8cd2618507cbea75b6c28eb444ecff..0e3ecaf69f4ad769adb1f286a95c56beb25b1a42 100644 (file)
                        int found = 0;
  
                        IEEE80211_LOCK_IRQ(vap->iv_ic);
-@@ -3551,10 +3561,12 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+@@ -3553,10 +3563,12 @@ ieee80211_recv_mgmt(struct ieee80211vap 
                                        ni->ni_associd |= 0xc000;
                                        avp->iv_wdsnode = ieee80211_ref_node(ni);
                                        IEEE80211_UNLOCK_IRQ(ic);
                        } else {
                                /*
                                 * Copy data from beacon to neighbor table.
-@@ -3593,6 +3605,8 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+@@ -3595,6 +3607,8 @@ ieee80211_recv_mgmt(struct ieee80211vap 
                                ni->ni_rssi = rssi;
                                ni->ni_rtsf = rtsf;
                                ni->ni_last_rx = jiffies;
index becd4c99f5e0420b93717e49de43eefe19bc944e..c754bfa9f0afbf4218969dd27cc3d3ca6f83b1e6 100644 (file)
@@ -1,6 +1,6 @@
 --- a/net80211/ieee80211_input.c
 +++ b/net80211/ieee80211_input.c
-@@ -3619,6 +3619,8 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+@@ -3621,6 +3621,8 @@ ieee80211_recv_mgmt(struct ieee80211vap 
                        vap->iv_stats.is_rx_mgtdiscard++;
                        return;
                }
index b12cf6797d055e7b747f58d9181ed51fe6efd93f..b12930fbdf4dfe67749395156e1aa7b5f685e654 100644 (file)
@@ -44,8 +44,8 @@
                        if (dir != IEEE80211_FC1_DIR_NODS) {
                                IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
                                        wh, "data", "invalid dir 0x%x", dir);
-@@ -3556,6 +3561,11 @@ ieee80211_recv_mgmt(struct ieee80211vap 
-                       } else if (vap->iv_opmode == IEEE80211_M_WDS) {
+@@ -3558,6 +3563,11 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                       } else if ((vap->iv_opmode == IEEE80211_M_WDS) && vap->iv_wdsnode) {
                                found = 1;
                                ni = ni_or_null = vap->iv_wdsnode;
 +                      } else if (vap->iv_opmode == IEEE80211_M_IBSS) {
@@ -56,7 +56,7 @@
                        }
                        IEEE80211_UNLOCK_IRQ(vap->iv_ic);
  
-@@ -3684,19 +3694,8 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+@@ -3686,19 +3696,8 @@ ieee80211_recv_mgmt(struct ieee80211vap 
                        vap->iv_stats.is_rx_ssidmismatch++; /*XXX*/
                        return;
                }
index d25d3cc88f9cbf9eaceae2b8ae4ebbb001d93f52..8349b318f266dfe27301d8f708995f0af5f2a78e 100644 (file)
                        int found = 0;
  
                        IEEE80211_LOCK_IRQ(vap->iv_ic);
-@@ -3568,14 +3561,12 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+@@ -3570,14 +3563,12 @@ ieee80211_recv_mgmt(struct ieee80211vap 
                                        }
                                }
                                if (found)
 -                                      ni = ni_or_null = avp->iv_wdsnode;
 +                                      tni = ieee80211_ref_node(avp->iv_wdsnode);
-                       } else if (vap->iv_opmode == IEEE80211_M_WDS) {
+                       } else if ((vap->iv_opmode == IEEE80211_M_WDS) && vap->iv_wdsnode) {
                                found = 1;
 -                              ni = ni_or_null = vap->iv_wdsnode;
 -                      } else if (vap->iv_opmode == IEEE80211_M_IBSS) {
@@ -72,7 +72,7 @@
                                found = 1;
                        }
                        IEEE80211_UNLOCK_IRQ(vap->iv_ic);
-@@ -3583,20 +3574,21 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+@@ -3585,20 +3576,21 @@ ieee80211_recv_mgmt(struct ieee80211vap 
                        if (!found)
                                break;
  
                        } else {
                                /*
                                 * Copy data from beacon to neighbor table.
-@@ -3604,39 +3596,38 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+@@ -3606,39 +3598,38 @@ ieee80211_recv_mgmt(struct ieee80211vap 
                                 * ieee80211_add_neighbor(), so we just copy
                                 * everything over to be safe.
                                 */