summaryrefslogtreecommitdiff
path: root/fs/crypto/keyinfo.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2017-11-08 12:17:15 +0300
committerIngo Molnar <mingo@kernel.org>2017-11-08 12:17:15 +0300
commit8a103df440afea30c91ebd42e61dc644e647f4bd (patch)
tree2cfa99e9c6e1e138e1404bce4294e46cb0034cce /fs/crypto/keyinfo.c
parenta9903f04e0a4ea522d959c2f287cdf0ab029e324 (diff)
parentfbc3edf7d7731d7a22c483c679700589bab936a3 (diff)
downloadlinux-8a103df440afea30c91ebd42e61dc644e647f4bd.tar.xz
Merge branch 'linus' into sched/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'fs/crypto/keyinfo.c')
-rw-r--r--fs/crypto/keyinfo.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/crypto/keyinfo.c b/fs/crypto/keyinfo.c
index 018c588c7ac3..a38630214058 100644
--- a/fs/crypto/keyinfo.c
+++ b/fs/crypto/keyinfo.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* key management facility for FS encryption support.
*
@@ -109,6 +110,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;