]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - security/keys/key.c
security: keys: Replace time_t/timespec with time64_t
[mirror_ubuntu-bionic-kernel.git] / security / keys / key.c
index 83bf4b4afd49d24ba80209a9bff71a558bd01b6c..32fd33d45959b76c5b53cebc82d28785672e05d8 100644 (file)
@@ -570,7 +570,6 @@ int key_reject_and_link(struct key *key,
                        struct key *authkey)
 {
        struct assoc_array_edit *edit;
-       struct timespec now;
        int ret, awaken, link_ret = 0;
 
        key_check(key);
@@ -593,8 +592,7 @@ int key_reject_and_link(struct key *key,
                /* mark the key as being negatively instantiated */
                atomic_inc(&key->user->nikeys);
                mark_key_instantiated(key, -error);
-               now = current_kernel_time();
-               key->expiry = now.tv_sec + timeout;
+               key->expiry = ktime_get_real_seconds() + timeout;
                key_schedule_gc(key->expiry + key_gc_delay);
 
                if (test_and_clear_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags))
@@ -710,16 +708,13 @@ found_kernel_type:
 
 void key_set_timeout(struct key *key, unsigned timeout)
 {
-       struct timespec now;
-       time_t expiry = 0;
+       time64_t expiry = 0;
 
        /* make the changes with the locks held to prevent races */
        down_write(&key->sem);
 
-       if (timeout > 0) {
-               now = current_kernel_time();
-               expiry = now.tv_sec + timeout;
-       }
+       if (timeout > 0)
+               expiry = ktime_get_real_seconds() + timeout;
 
        key->expiry = expiry;
        key_schedule_gc(key->expiry + key_gc_delay);
@@ -1028,8 +1023,7 @@ EXPORT_SYMBOL(key_update);
  */
 void key_revoke(struct key *key)
 {
-       struct timespec now;
-       time_t time;
+       time64_t time;
 
        key_check(key);
 
@@ -1044,8 +1038,7 @@ void key_revoke(struct key *key)
                key->type->revoke(key);
 
        /* set the death time to no more than the expiry time */
-       now = current_kernel_time();
-       time = now.tv_sec;
+       time = ktime_get_real_seconds();
        if (key->revoked_at == 0 || key->revoked_at > time) {
                key->revoked_at = time;
                key_schedule_gc(key->revoked_at + key_gc_delay);