KEYS: Fix keyring content gc scanner
[platform/adaptation/renesas_rcar/renesas_kernel.git] / security / keys / gc.c
index cce621c..d3222b6 100644 (file)
@@ -130,46 +130,6 @@ void key_gc_keytype(struct key_type *ktype)
        kleave("");
 }
 
-static int key_gc_keyring_func(const void *object, void *iterator_data)
-{
-       const struct key *key = object;
-       time_t *limit = iterator_data;
-       return key_is_dead(key, *limit);
-}
-
-/*
- * Garbage collect pointers from a keyring.
- *
- * Not called with any locks held.  The keyring's key struct will not be
- * deallocated under us as only our caller may deallocate it.
- */
-static void key_gc_keyring(struct key *keyring, time_t limit)
-{
-       int result;
-
-       kenter("%x{%s}", keyring->serial, keyring->description ?: "");
-
-       if (keyring->flags & ((1 << KEY_FLAG_INVALIDATED) |
-                             (1 << KEY_FLAG_REVOKED)))
-               goto dont_gc;
-
-       /* scan the keyring looking for dead keys */
-       rcu_read_lock();
-       result = assoc_array_iterate(&keyring->keys,
-                                    key_gc_keyring_func, &limit);
-       rcu_read_unlock();
-       if (result == true)
-               goto do_gc;
-
-dont_gc:
-       kleave(" [no gc]");
-       return;
-
-do_gc:
-       keyring_gc(keyring, limit);
-       kleave(" [gc]");
-}
-
 /*
  * Garbage collect a list of unreferenced, detached keys
  */
@@ -388,7 +348,7 @@ found_unreferenced_key:
         */
 found_keyring:
        spin_unlock(&key_serial_lock);
-       key_gc_keyring(key, limit);
+       keyring_gc(key, limit);
        goto maybe_resched;
 
        /* We found a dead key that is still referenced.  Reset its type and