]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mac80211: fix key todo list order
authorJohannes Berg <johannes@sipsolutions.net>
Sun, 13 Apr 2008 08:43:50 +0000 (10:43 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 16 Apr 2008 19:59:57 +0000 (15:59 -0400)
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@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/key.c

index b98711dcdc54ec5cef69036862902f9087a0ae1b..150d66dbda9d22de6ca0b94c48eab7e70c3f733f 100644 (file)
@@ -74,9 +74,12 @@ static void add_todo(struct ieee80211_key *key, u32 flag)
 
        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);
 }