Skip to content

Commit

Permalink
KEYS: Have the garbage collector set its timer for live expired keys
Browse files Browse the repository at this point in the history
The key garbage collector sets a timer to start a new collection cycle at the
point the earliest key to expire should be considered garbage.  However, it
currently only does this if the key it is considering hasn't yet expired.

If the key being considering has expired, but hasn't yet reached the collection
time then it is ignored, and won't be collected until some other key provokes a
round of collection.

Make the garbage collector set the timer for the earliest key that hasn't yet
passed its collection time, rather than the earliest key that hasn't yet
expired.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
  • Loading branch information
David Howells authored and James Morris committed Sep 23, 2009
1 parent 0afd905 commit 606531c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions security/keys/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ static void key_garbage_collector(struct work_struct *work)

/* trawl through the keys looking for keyrings */
for (;;) {
if (key->expiry > now && key->expiry < new_timer) {
if (key->expiry > limit && key->expiry < new_timer) {
kdebug("will expire %x in %ld",
key_serial(key), key->expiry - now);
key_serial(key), key->expiry - limit);
new_timer = key->expiry;
}

Expand Down

0 comments on commit 606531c

Please sign in to comment.