]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - security/keys/gc.c
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[mirror_ubuntu-bionic-kernel.git] / security / keys / gc.c
index b93603724b8c0afb153d53039e3c2a81e33cc909..7207e6094dc1622c9a51beedc92288cdec244de1 100644 (file)
@@ -32,7 +32,7 @@ DECLARE_WORK(key_gc_work, key_garbage_collector);
 static void key_gc_timer_func(struct timer_list *);
 static DEFINE_TIMER(key_gc_timer, key_gc_timer_func);
 
-static time_t key_gc_next_run = LONG_MAX;
+static time64_t key_gc_next_run = TIME64_MAX;
 static struct key_type *key_gc_dead_keytype;
 
 static unsigned long key_gc_flags;
@@ -53,12 +53,12 @@ struct key_type key_type_dead = {
  * Schedule a garbage collection run.
  * - time precision isn't particularly important
  */
-void key_schedule_gc(time_t gc_at)
+void key_schedule_gc(time64_t gc_at)
 {
        unsigned long expires;
-       time_t now = current_kernel_time().tv_sec;
+       time64_t now = ktime_get_real_seconds();
 
-       kenter("%ld", gc_at - now);
+       kenter("%lld", gc_at - now);
 
        if (gc_at <= now || test_bit(KEY_GC_REAP_KEYTYPE, &key_gc_flags)) {
                kdebug("IMMEDIATE");
@@ -87,7 +87,7 @@ void key_schedule_gc_links(void)
 static void key_gc_timer_func(struct timer_list *unused)
 {
        kenter("");
-       key_gc_next_run = LONG_MAX;
+       key_gc_next_run = TIME64_MAX;
        key_schedule_gc_links();
 }
 
@@ -184,11 +184,11 @@ static void key_garbage_collector(struct work_struct *work)
 
        struct rb_node *cursor;
        struct key *key;
-       time_t new_timer, limit;
+       time64_t new_timer, limit;
 
        kenter("[%lx,%x]", key_gc_flags, gc_state);
 
-       limit = current_kernel_time().tv_sec;
+       limit = ktime_get_real_seconds();
        if (limit > key_gc_delay)
                limit -= key_gc_delay;
        else
@@ -204,7 +204,7 @@ static void key_garbage_collector(struct work_struct *work)
                gc_state |= KEY_GC_REAPING_DEAD_1;
        kdebug("new pass %x", gc_state);
 
-       new_timer = LONG_MAX;
+       new_timer = TIME64_MAX;
 
        /* As only this function is permitted to remove things from the key
         * serial tree, if cursor is non-NULL then it will always point to a
@@ -235,7 +235,7 @@ continue_scanning:
 
                if (gc_state & KEY_GC_SET_TIMER) {
                        if (key->expiry > limit && key->expiry < new_timer) {
-                               kdebug("will expire %x in %ld",
+                               kdebug("will expire %x in %lld",
                                       key_serial(key), key->expiry - limit);
                                new_timer = key->expiry;
                        }
@@ -276,7 +276,7 @@ maybe_resched:
         */
        kdebug("pass complete");
 
-       if (gc_state & KEY_GC_SET_TIMER && new_timer != (time_t)LONG_MAX) {
+       if (gc_state & KEY_GC_SET_TIMER && new_timer != (time64_t)TIME64_MAX) {
                new_timer += key_gc_delay;
                key_schedule_gc(new_timer);
        }