aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211/ieee80211_crypt_tkip.c
diff options
context:
space:
mode:
authorJames Ketrenos <jketreno@linux.intel.com>2005-09-21 12:53:43 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-21 23:01:52 -0400
commit20d64713ae71c0b0aa06084acbef2244021baaca (patch)
treef9af562b0bc70f7f75d0195aacf155fd3ec6628a /net/ieee80211/ieee80211_crypt_tkip.c
parent4ca5253d573d7b3785dbb2f123f948fdca6ee235 (diff)
[PATCH] ieee80211: Fixed a kernel oops on module unload
tree 367069f24fc38b4aa910e86ff40094d2078d8aa7 parent a33a1982012e9070736e3717231714dc9892303b author James Ketrenos <jketreno@linux.intel.com> 1124430800 -0500 committer James Ketrenos <jketreno@linux.intel.com> 1127310571 -0500 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) Added ieee80211_device as the first parameter to the crypt init() method. TKIP modified to use that structure for determining whether to countermeasures are active. Signed-off-by: James Ketrenos <jketreno@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'net/ieee80211/ieee80211_crypt_tkip.c')
-rw-r--r--net/ieee80211/ieee80211_crypt_tkip.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c
index dca380e57454..0c495f07e718 100644
--- a/net/ieee80211/ieee80211_crypt_tkip.c
+++ b/net/ieee80211/ieee80211_crypt_tkip.c
@@ -59,9 +59,11 @@ struct ieee80211_tkip_data {
59 59
60 /* scratch buffers for virt_to_page() (crypto API) */ 60 /* scratch buffers for virt_to_page() (crypto API) */
61 u8 rx_hdr[16], tx_hdr[16]; 61 u8 rx_hdr[16], tx_hdr[16];
62
63 struct ieee80211_device *ieee;
62}; 64};
63 65
64static void *ieee80211_tkip_init(int key_idx) 66static void *ieee80211_tkip_init(struct ieee80211_device *ieee, int key_idx)
65{ 67{
66 struct ieee80211_tkip_data *priv; 68 struct ieee80211_tkip_data *priv;
67 69
@@ -69,6 +71,9 @@ static void *ieee80211_tkip_init(int key_idx)
69 if (priv == NULL) 71 if (priv == NULL)
70 goto fail; 72 goto fail;
71 memset(priv, 0, sizeof(*priv)); 73 memset(priv, 0, sizeof(*priv));
74
75 priv->ieee = ieee;
76
72 priv->key_idx = key_idx; 77 priv->key_idx = key_idx;
73 78
74 priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0); 79 priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0);
@@ -264,11 +269,21 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
264 u32 crc; 269 u32 crc;
265 struct scatterlist sg; 270 struct scatterlist sg;
266 271
272 hdr = (struct ieee80211_hdr *)skb->data;
273
274 if (tkey->ieee->tkip_countermeasures) {
275 if (net_ratelimit()) {
276 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
277 "TX packet to " MAC_FMT "\n",
278 tkey->ieee->dev->name, MAC_ARG(hdr->addr1));
279 }
280 return -1;
281 }
282
267 if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 || 283 if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 ||
268 skb->len < hdr_len) 284 skb->len < hdr_len)
269 return -1; 285 return -1;
270 286
271 hdr = (struct ieee80211_hdr *)skb->data;
272 if (!tkey->tx_phase1_done) { 287 if (!tkey->tx_phase1_done) {
273 tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, 288 tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
274 tkey->tx_iv32); 289 tkey->tx_iv32);
@@ -325,10 +340,20 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
325 struct scatterlist sg; 340 struct scatterlist sg;
326 int plen; 341 int plen;
327 342
343 hdr = (struct ieee80211_hdr *)skb->data;
344
345 if (tkey->ieee->tkip_countermeasures) {
346 if (net_ratelimit()) {
347 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
348 "received packet from " MAC_FMT "\n",
349 tkey->ieee->dev->name, MAC_ARG(hdr->addr2));
350 }
351 return -1;
352 }
353
328 if (skb->len < hdr_len + 8 + 4) 354 if (skb->len < hdr_len + 8 + 4)
329 return -1; 355 return -1;
330 356
331 hdr = (struct ieee80211_hdr *)skb->data;
332 pos = skb->data + hdr_len; 357 pos = skb->data + hdr_len;
333 keyidx = pos[3]; 358 keyidx = pos[3];
334 if (!(keyidx & (1 << 5))) { 359 if (!(keyidx & (1 << 5))) {