License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[linux-2.6-block.git] / fs / crypto / keyinfo.c
index 018c588c7ac3b7ac8fd78b4092332f771c6411c0..a38630214058214dec6c30eca64f74f3f7f693df 100644 (file)
@@ -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;