summaryrefslogtreecommitdiff
path: root/fs/crypto/keyinfo.c
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2017-10-19 12:28:38 +1100
committerJames Morris <james.l.morris@oracle.com>2017-10-19 12:28:38 +1100
commit494b9ae7abb84e6d88d7587906aff29dd26cf9d0 (patch)
treeaeb24854a715777aaa9d433d57f5e45d05017f73 /fs/crypto/keyinfo.c
parent73d3393ada4f70fa3df5639c8d438f2f034c0ecb (diff)
parent68a1fdbbf8bd3378325e45c19e167a165f9ffc3a (diff)
Merge commit 'tags/keys-fixes-20171018' into fixes-v4.14-rc5
Diffstat (limited to 'fs/crypto/keyinfo.c')
-rw-r--r--fs/crypto/keyinfo.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/crypto/keyinfo.c b/fs/crypto/keyinfo.c
index 018c588c7ac3..8e704d12a1cf 100644
--- a/fs/crypto/keyinfo.c
+++ b/fs/crypto/keyinfo.c
@@ -109,6 +109,11 @@ static int validate_user_key(struct fscrypt_info *crypt_info,
goto out;
}
ukp = user_key_payload_locked(keyring_key);
+ if (!ukp) {
+ /* key was revoked before we acquired its semaphore */
+ res = -EKEYREVOKED;
+ goto out;
+ }
if (ukp->datalen != sizeof(struct fscrypt_key)) {
res = -EINVAL;
goto out;