public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: gregor kowski <gregor.kowski@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] mac80211 : fix a race with update_tkip_key
Date: Wed, 10 Jun 2009 21:42:47 +0200	[thread overview]
Message-ID: <83a869cd0906101242w2ae8480cle69abd19a9d87112@mail.gmail.com> (raw)
In-Reply-To: <1244569926.18481.27.camel@johannes.local>

On Tue, Jun 9, 2009 at 7:52 PM, Johannes Berg<johannes@sipsolutions.net> wrote:
> On Tue, 2009-06-09 at 19:48 +0200, gregor kowski wrote:
>
>> > Right. But drivers are free to even only _encrypt_ tkip frames and never
>> > _decrypt_ them after having accepted a hardware key, iow that is
>> > perfectly valid behaviour and I don't think we should keep uploading the
>> > key to the driver. Worst case is that the proper upload fails and we
>> > decrypt all frames in software until the next rollover.
>> >
>> What's the point of setting the tkip callback if we aren't interested
>> in decrypting data by hardware ?
>
> Might depend on something else? Anyhow I don't see the point of
> continuing to call the callback. Maybe it should just be part of the key
> todo instead when the key is initially uploaded to the hw.

Or what do you think about this. This will call the callback only once per wrap.

Gregor.


Index: linux-2.6/net/mac80211/tkip.c
===================================================================
--- linux-2.6.orig/net/mac80211/tkip.c	2009-06-08 19:37:19.000000000 +0000
+++ linux-2.6/net/mac80211/tkip.c	2009-06-10 19:28:20.000000000 +0000
@@ -274,7 +274,7 @@

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

@@ -298,19 +298,22 @@
 			printk("\n");
 		}
 #endif
-		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) {
+		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);
+		key->u.tkip.rx[queue].initialized = 2;
 	}

 	tkip_mixing_phase2(tk, &key->u.tkip.rx[queue], iv16, rc4key);

  reply	other threads:[~2009-06-10 19:42 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <83a869cd0906071445i13a5398y5e94ea3d91123c3b@mail.gmail.com>
2009-06-07 21:49 ` [PATCH] mac80211 : fix a race with update_tkip_key gregor kowski
2009-06-08  6:29   ` Johannes Berg
2009-06-08 17:51     ` gregor kowski
2009-06-09 14:02       ` Johannes Berg
2009-06-09 17:48         ` gregor kowski
2009-06-09 17:52           ` Johannes Berg
2009-06-10 19:42             ` gregor kowski [this message]
2009-06-10 22:17               ` gregor kowski
2009-06-11 20:11                 ` Johannes Berg
2009-06-11 20:07               ` Johannes Berg
2009-06-12 20:41                 ` gregor kowski
2009-06-12 20:47                   ` Johannes Berg
2009-06-19 19:33                     ` gregor kowski
2009-06-19 19:37                       ` gregor kowski
2009-06-21  9:21                         ` Johannes Berg
2009-06-22 20:48                           ` gregor kowski
2009-08-21 22:13 gregor kowski
2009-08-22  7:45 ` Johannes Berg
2009-11-07 18:10   ` gregor kowski
2009-11-07 19:22     ` Johannes Berg
2009-11-16 21:53       ` gregor kowski
2009-11-16 21:56         ` Johannes Berg
2009-12-07 21:05           ` gregor kowski
2009-12-07 21:06           ` gregor kowski
2009-12-09 22:21             ` gregor kowski
2009-12-09 22:25               ` gregor kowski
2009-12-28 16:46                 ` gregor kowski
2009-12-28 17:23                   ` John W. Linville

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83a869cd0906101242w2ae8480cle69abd19a9d87112@mail.gmail.com \
    --to=gregor.kowski@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox