mac80211: fix unaligned access in ieee80211_wep_encrypt_data
authorIvan Kuten <ivan.kuten@promwad.com>
Mon, 24 Nov 2008 20:17:54 +0000 (15:17 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 26 Nov 2008 14:47:51 +0000 (09:47 -0500)
Signed-off-by: Ivan Kuten <ivan.kuten@promwad.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/wep.c

index 7bbb98e846a3f1e26014b2b04f6a78dec35966ed..7043ddc75498f0f952586c58d4f4371d13984007 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/err.h>
 #include <linux/mm.h>
 #include <linux/scatterlist.h>
+#include <asm/unaligned.h>
 
 #include <net/mac80211.h>
 #include "ieee80211_i.h"
@@ -125,10 +126,10 @@ void ieee80211_wep_encrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key,
 {
        struct blkcipher_desc desc = { .tfm = tfm };
        struct scatterlist sg;
-       __le32 *icv;
+       __le32 icv;
 
-       icv = (__le32 *)(data + data_len);
-       *icv = cpu_to_le32(~crc32_le(~0, data, data_len));
+       icv = cpu_to_le32(~crc32_le(~0, data, data_len));
+       put_unaligned(icv, (__le32 *)(data + data_len));
 
        crypto_blkcipher_setkey(tfm, rc4key, klen);
        sg_init_one(&sg, data, data_len + WEP_ICV_LEN);