]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
eCryptfs: use list_for_each_entry_safe() when wiping auth toks
authorMichael Halcrow <mhalcrow@us.ibm.com>
Tue, 16 Oct 2007 08:27:55 +0000 (01:27 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 16 Oct 2007 16:43:10 +0000 (09:43 -0700)
Use list_for_each_entry_safe() when wiping the authentication token list.

Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ecryptfs/keystore.c

index a1764fe3318cee68005053b894a594ff94760e70..8eb0746313d02abd4f8ae77e40dde90a70367d44 100644 (file)
@@ -469,26 +469,19 @@ out:
 
 static void wipe_auth_tok_list(struct list_head *auth_tok_list_head)
 {
-       struct list_head *walker;
        struct ecryptfs_auth_tok_list_item *auth_tok_list_item;
+       struct ecryptfs_auth_tok_list_item *auth_tok_list_item_tmp;
 
-       walker = auth_tok_list_head->next;
-       while (walker != auth_tok_list_head) {
-               auth_tok_list_item =
-                   list_entry(walker, struct ecryptfs_auth_tok_list_item,
-                              list);
-               walker = auth_tok_list_item->list.next;
-               memset(auth_tok_list_item, 0,
-                      sizeof(struct ecryptfs_auth_tok_list_item));
+       list_for_each_entry_safe(auth_tok_list_item, auth_tok_list_item_tmp,
+                                auth_tok_list_head, list) {
+               list_del(&auth_tok_list_item->list);
                kmem_cache_free(ecryptfs_auth_tok_list_item_cache,
                                auth_tok_list_item);
        }
-       auth_tok_list_head->next = NULL;
 }
 
 struct kmem_cache *ecryptfs_auth_tok_list_item_cache;
 
-
 /**
  * parse_tag_1_packet
  * @crypt_stat: The cryptographic context to modify based on packet