Linux wireless drivers development
 help / color / mirror / Atom feed
* ieee80211_wep_encrypt_data_fix_unaligned_access.patch
@ 2008-11-21 22:46 Ivan Kuten
  2008-11-22 17:18 ` ieee80211_wep_encrypt_data_fix_unaligned_access.patch Johannes Berg
  2008-11-22 17:59 ` ieee80211_wep_encrypt_data_fix_unaligned_access.patch Johannes Berg
  0 siblings, 2 replies; 4+ messages in thread
From: Ivan Kuten @ 2008-11-21 22:46 UTC (permalink / raw)
  To: linux-wireless

Hello, 

Please review the following patch which is supposed to fix unaligned access
on Blackfin architecture.
In function net/mac80211/wep.c ieee80211_wep_encrypt_data:
__le32 *icv;
icv = (__le32 *)(data + data_len); 

after the operation above icv pointer may become unaligned. 
The patch below fixes this issue:


--- linux-2.6.28-rc3/net/mac80211/wep.c 2008-11-20 00:04:58.000000000 -0500
+++ linux-2.6.86-rc3.new/net/mac80211/wep.c     2008-11-22
00:37:53.000000000 -0500
@@ -123,10 +123,10 @@
 {
        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);


Comments?

Regards,
Ivan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ieee80211_wep_encrypt_data_fix_unaligned_access.patch
  2008-11-21 22:46 ieee80211_wep_encrypt_data_fix_unaligned_access.patch Ivan Kuten
@ 2008-11-22 17:18 ` Johannes Berg
  2008-11-22 17:58   ` ieee80211_wep_encrypt_data_fix_unaligned_access.patch Johannes Berg
  2008-11-22 17:59 ` ieee80211_wep_encrypt_data_fix_unaligned_access.patch Johannes Berg
  1 sibling, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2008-11-22 17:18 UTC (permalink / raw)
  To: Ivan Kuten; +Cc: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

On Sat, 2008-11-22 at 00:46 +0200, Ivan Kuten wrote:

> -       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));

Aren't you putting a pointer now??

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ieee80211_wep_encrypt_data_fix_unaligned_access.patch
  2008-11-22 17:18 ` ieee80211_wep_encrypt_data_fix_unaligned_access.patch Johannes Berg
@ 2008-11-22 17:58   ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2008-11-22 17:58 UTC (permalink / raw)
  To: Ivan Kuten; +Cc: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 423 bytes --]

On Sat, 2008-11-22 at 18:18 +0100, Johannes Berg wrote:
> On Sat, 2008-11-22 at 00:46 +0200, Ivan Kuten wrote:
> 
> > -       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));
> 
> Aren't you putting a pointer now??

Never mind.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ieee80211_wep_encrypt_data_fix_unaligned_access.patch
  2008-11-21 22:46 ieee80211_wep_encrypt_data_fix_unaligned_access.patch Ivan Kuten
  2008-11-22 17:18 ` ieee80211_wep_encrypt_data_fix_unaligned_access.patch Johannes Berg
@ 2008-11-22 17:59 ` Johannes Berg
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2008-11-22 17:59 UTC (permalink / raw)
  To: Ivan Kuten; +Cc: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1094 bytes --]

On Sat, 2008-11-22 at 00:46 +0200, Ivan Kuten wrote:
> Hello, 
> 
> Please review the following patch which is supposed to fix unaligned access
> on Blackfin architecture.

any other architecture too...

> In function net/mac80211/wep.c ieee80211_wep_encrypt_data:
> __le32 *icv;
> icv = (__le32 *)(data + data_len); 
> 
> after the operation above icv pointer may become unaligned. 
> The patch below fixes this issue:
> 
> 
> --- linux-2.6.28-rc3/net/mac80211/wep.c 2008-11-20 00:04:58.000000000 -0500
> +++ linux-2.6.86-rc3.new/net/mac80211/wep.c     2008-11-22
> 00:37:53.000000000 -0500
> @@ -123,10 +123,10 @@
>  {
>         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));
> 

looks fine, you just need to send a proper changelog and s-o-b

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-11-22 17:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-21 22:46 ieee80211_wep_encrypt_data_fix_unaligned_access.patch Ivan Kuten
2008-11-22 17:18 ` ieee80211_wep_encrypt_data_fix_unaligned_access.patch Johannes Berg
2008-11-22 17:58   ` ieee80211_wep_encrypt_data_fix_unaligned_access.patch Johannes Berg
2008-11-22 17:59 ` ieee80211_wep_encrypt_data_fix_unaligned_access.patch Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox