Skip to content
  • Eric Biggers's avatar
    KEYS: load key flags and expiry time atomically in key_validate() · 1823d475
    Eric Biggers authored
    
    
    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: default avatarEric Biggers <ebiggers@google.com>
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    1823d475