diff options
author | James Morris <james.l.morris@oracle.com> | 2017-10-19 12:28:38 +1100 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2017-10-19 12:28:38 +1100 |
commit | 494b9ae7abb84e6d88d7587906aff29dd26cf9d0 (patch) | |
tree | aeb24854a715777aaa9d433d57f5e45d05017f73 /security/keys/permission.c | |
parent | 73d3393ada4f70fa3df5639c8d438f2f034c0ecb (diff) | |
parent | 68a1fdbbf8bd3378325e45c19e167a165f9ffc3a (diff) | |
download | linux-494b9ae7abb84e6d88d7587906aff29dd26cf9d0.tar.bz2 |
Merge commit 'tags/keys-fixes-20171018' into fixes-v4.14-rc5
Diffstat (limited to 'security/keys/permission.c')
-rw-r--r-- | security/keys/permission.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/security/keys/permission.c b/security/keys/permission.c index 732cc0beffdf..a72b4dd70c8a 100644 --- a/security/keys/permission.c +++ b/security/keys/permission.c @@ -88,7 +88,8 @@ EXPORT_SYMBOL(key_task_permission); */ int key_validate(const struct key *key) { - unsigned long flags = key->flags; + unsigned long flags = READ_ONCE(key->flags); + time_t expiry = READ_ONCE(key->expiry); if (flags & (1 << KEY_FLAG_INVALIDATED)) return -ENOKEY; @@ -99,9 +100,9 @@ int key_validate(const struct key *key) return -EKEYREVOKED; /* check it hasn't expired */ - if (key->expiry) { + if (expiry) { struct timespec now = current_kernel_time(); - if (now.tv_sec >= key->expiry) + if (now.tv_sec >= expiry) return -EKEYEXPIRED; } |