]> err.no Git - linux-2.6/commitdiff
mac80211: don't accept WEP keys other than WEP40 and WEP104
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Fri, 27 Jun 2008 23:50:13 +0000 (02:50 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 30 Jun 2008 19:43:53 +0000 (15:43 -0400)
This patch makes mac80211 refuse a WEP key whose length is not WEP40 nor
WEP104.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
include/net/mac80211.h
net/mac80211/wext.c

index dae3f9ec11549b240ae07be19dc4f58a2389ce62..bcd1623245cbfc09e879776beceeafeeee229fdc 100644 (file)
@@ -595,6 +595,15 @@ enum ieee80211_key_alg {
        ALG_CCMP,
 };
 
+/**
+ * enum ieee80211_key_len - key length
+ * @WEP40: WEP 5 byte long key
+ * @WEP104: WEP 13 byte long key
+ */
+enum ieee80211_key_len {
+       LEN_WEP40 = 5,
+       LEN_WEP104 = 13,
+};
 
 /**
  * enum ieee80211_key_flags - key flags
index 6106cb79060c928f65e7d5a5d2154f280b55bf5f..e8404212ad57ecdfda2df597a9725c73278627b4 100644 (file)
@@ -95,6 +95,13 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
                        }
                }
 
+               if (alg == ALG_WEP &&
+                       key_len != LEN_WEP40 && key_len != LEN_WEP104) {
+                       ieee80211_key_free(key);
+                       err = -EINVAL;
+                       goto out_unlock;
+               }
+
                ieee80211_key_link(key, sdata, sta);
 
                if (set_tx_key || (!sta && !sdata->default_key && key))