aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/keys/gc.c')
-rw-r--r--security/keys/gc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/security/keys/gc.c b/security/keys/gc.c
index bf4d8da5a795..a42b45531aac 100644
--- a/security/keys/gc.c
+++ b/security/keys/gc.c
@@ -145,7 +145,9 @@ static void key_gc_keyring(struct key *keyring, time_t limit)
145 if (!klist) 145 if (!klist)
146 goto unlock_dont_gc; 146 goto unlock_dont_gc;
147 147
148 for (loop = klist->nkeys - 1; loop >= 0; loop--) { 148 loop = klist->nkeys;
149 smp_rmb();
150 for (loop--; loop >= 0; loop--) {
149 key = klist->keys[loop]; 151 key = klist->keys[loop];
150 if (test_bit(KEY_FLAG_DEAD, &key->flags) || 152 if (test_bit(KEY_FLAG_DEAD, &key->flags) ||
151 (key->expiry > 0 && key->expiry <= limit)) 153 (key->expiry > 0 && key->expiry <= limit))