From: James K. <jke...@li...> - 2005-09-13 22:36:43
|
Fixed a kernel oops on module unload by adding spin lock protection to ieee80211's crypt handlers (thanks to Zhu Yi) Modified scan result logic to report WPA and RSN IEs if set (vs.being based on wpa_enabled) Signed-off-by: James Ketrenos <jke...@li...> --- include/net/ieee80211.h | 7 +++++++ include/net/ieee80211_crypt.h | 18 ++++++++++++++++++ net/ieee80211/ieee80211_crypt.c | 6 +++--- net/ieee80211/ieee80211_wx.c | 4 ++-- 4 files changed, 30 insertions(+), 5 deletions(-) 797dee9362c95cb8a063b35a7cb5c3bd85cf97b1 diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h @@ -24,6 +24,12 @@ #include <linux/kernel.h> /* ARRAY_SIZE */ #include <linux/wireless.h> +#ifdef CONFIG_IEEE80211_CRYPT_TKIP_MODULE +#ifndef CONFIG_IEEE80211_CRYPT_TKIP +#define CONFIG_IEEE80211_CRYPT_TKIP +#endif +#endif + #define IEEE80211_DATA_LEN 2304 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 6.2.1.1.2. @@ -434,6 +440,7 @@ struct ieee80211_device; #define SEC_KEY_2 (1<<1) #define SEC_KEY_3 (1<<2) #define SEC_KEY_4 (1<<3) +#define SEC_KEY_MASK (SEC_KEY_1 | SEC_KEY_2 | SEC_KEY_3 | SEC_KEY_4) #define SEC_ACTIVE_KEY (1<<4) #define SEC_AUTH_MODE (1<<5) #define SEC_UNICAST_GROUP (1<<6) diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h --- a/include/net/ieee80211_crypt.h +++ b/include/net/ieee80211_crypt.h @@ -25,6 +25,24 @@ #include <linux/skbuff.h> +#ifdef CONFIG_IEEE80211_WPA_MODULE +#ifndef CONFIG_IEEE80211_WPA +#define CONFIG_IEEE80211_WPA +#endif +#endif + +#ifdef CONFIG_IEEE80211_CRYPT_CCMP_MODULE +#ifndef CONFIG_IEEE80211_CRYPT_CCMP +#define CONFIG_IEEE80211_CRYPT_CCMP +#endif +#endif + +#ifdef CONFIG_IEEE80211_CRYPT_TKIP_MODULE +#ifndef CONFIG_IEEE80211_CRYPT_TKIP +#define CONFIG_IEEE80211_CRYPT_TKIP +#endif +#endif + struct ieee80211_crypto_ops { const char *name; diff --git a/net/ieee80211/ieee80211_crypt.c b/net/ieee80211/ieee80211_crypt.c --- a/net/ieee80211/ieee80211_crypt.c +++ b/net/ieee80211/ieee80211_crypt.c @@ -41,7 +41,9 @@ void ieee80211_crypt_deinit_entries(stru { struct list_head *ptr, *n; struct ieee80211_crypt_data *entry; + unsigned long flags; + spin_lock_irqsave(&ieee->lock, flags); for (ptr = ieee->crypt_deinit_list.next, n = ptr->next; ptr != &ieee->crypt_deinit_list; ptr = n, n = ptr->next) { entry = list_entry(ptr, struct ieee80211_crypt_data, list); @@ -57,14 +59,13 @@ void ieee80211_crypt_deinit_entries(stru } kfree(entry); } + spin_unlock_irqrestore(&ieee->lock, flags); } void ieee80211_crypt_deinit_handler(unsigned long data) { struct ieee80211_device *ieee = (struct ieee80211_device *)data; - unsigned long flags; - spin_lock_irqsave(&ieee->lock, flags); ieee80211_crypt_deinit_entries(ieee, 0); if (!list_empty(&ieee->crypt_deinit_list)) { printk(KERN_DEBUG "%s: entries remaining in delayed crypt " @@ -72,7 +73,6 @@ void ieee80211_crypt_deinit_handler(unsi ieee->crypt_deinit_timer.expires = jiffies + HZ; add_timer(&ieee->crypt_deinit_timer); } - spin_unlock_irqrestore(&ieee->lock, flags); } diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c @@ -182,7 +182,7 @@ static inline char *ipw2100_translate_sc if (iwe.u.data.length) start = iwe_stream_add_point(start, stop, &iwe, custom); - if (ieee->wpa_enabled && network->wpa_ie_len) { + if (network->wpa_ie_len) { char buf[MAX_WPA_IE_LEN * 2 + 30]; u8 *p = buf; @@ -197,7 +197,7 @@ static inline char *ipw2100_translate_sc start = iwe_stream_add_point(start, stop, &iwe, buf); } - if (ieee->wpa_enabled && network->rsn_ie_len) { + if (network->rsn_ie_len) { char buf[MAX_WPA_IE_LEN * 2 + 30]; u8 *p = buf; |