Search Linux Wireless

[PATCH] mac80211: fix key todo list order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When we add multiple todo entries, we rely on them being executed
mostly in the right order, especially when a key is being replaced.
But when a default key is replaced, the todo list order will differ
from the order when the key being replaced is not a default key, so
problems will happen. Hence, just move each todo item to the end of
the list when it is added so we can in the other code ensure that
hw accel for a key will be disabled before it is enabled for the
replacement.

Signed-off-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
---
This is rather subtle. The patch should completely fix the problem seen
by Ehud, though in his case the other patch I mentioned in the thread
will already have fixed it since his WEP key is a default key.

 net/mac80211/key.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- everything.orig/net/mac80211/key.c	2008-04-13 10:36:43.000000000 +0200
+++ everything/net/mac80211/key.c	2008-04-13 10:40:47.000000000 +0200
@@ -74,9 +74,12 @@ static void add_todo(struct ieee80211_ke
 
 	spin_lock(&todo_lock);
 	key->flags |= flag;
-	/* only add if not already added */
-	if (list_empty(&key->todo))
-		list_add(&key->todo, &todo_list);
+	/*
+	 * Remove again if already on the list so that we move it to the end.
+	 */
+	if (!list_empty(&key->todo))
+		list_del(&key->todo);
+	list_add_tail(&key->todo, &todo_list);
 	schedule_work(&todo_work);
 	spin_unlock(&todo_lock);
 }

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux