Re: [PATCH] mac80211 : fix a race with update_tkip_key

Johannes Berg
2009-06-11T20:06:33Z

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

On Wed, 2009-06-10 at 21:42 +0200, gregor kowski wrote:

> if (only_iv) {
> res = TKIP_DECRYPT_OK;
> - key->u.tkip.rx[queue].initialized = 1;
> + key->u.tkip.rx[queue].initialized = 2;
> goto done;

Please change this variable to an enum with proper states.

> - if (key->local->ops->update_tkip_key &&
> - key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) {
> - u8 bcast[ETH_ALEN] =
> - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
> - u8 *sta_addr = key->sta->sta.addr;
> -
> - if (is_multicast_ether_addr(ra))
> - sta_addr = bcast;
> -
> - key->local->ops->update_tkip_key(
> - local_to_hw(key->local), &key->conf,
> - sta_addr, iv32, key->u.tkip.rx[queue].p1k);
> - }
> + }
> + /* initialized == 2 means we already call update_tkip_key */
> + if (key->local->ops->update_tkip_key &&
> + key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE &&
> + key->u.tkip.rx[queue].initialized != 2) {

and please indent only to after if ( here, like this:

if (key->... &&
key->flags & ...
key->...) {
u8 bcast[...]...

johannes

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