]> git.baikalelectronics.ru Git - kernel.git/commit
KEYS: load key flags and expiry time atomically in key_validate()
authorEric Biggers <ebiggers@google.com>
Wed, 27 Sep 2017 19:50:44 +0000 (12:50 -0700)
committerDavid Howells <dhowells@redhat.com>
Wed, 18 Oct 2017 08:12:41 +0000 (09:12 +0100)
commit3747880cb1a1e5d827352a8a373e57e593734699
tree0cc97d27ac4815b342887b85d5b8f274dd3d4095
parent396007bd802e9c22c1f66699b40b4a2172685bc4
KEYS: load key flags and expiry time atomically in key_validate()

In key_validate(), load the flags and expiry time once atomically, since
these can change concurrently if key_validate() is called without the
key semaphore held.  And we don't want to get inconsistent results if a
variable is referenced multiple times.  For example, key->expiry was
referenced in both 'if (key->expiry)' and in 'if (now.tv_sec >=
key->expiry)', making it theoretically possible to see a spurious
EKEYEXPIRED while the expiration time was being removed, i.e. set to 0.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
security/keys/permission.c