fscrypt: remove unnecessary check for non-logon key type
authorEric Biggers <ebiggers@google.com>
Mon, 30 Apr 2018 22:51:45 +0000 (15:51 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 28 Jun 2018 16:37:40 +0000 (09:37 -0700)
We're passing 'key_type_logon' to request_key(), so the found key is
guaranteed to be of type "logon".  Thus, there is no reason to check
later that the key is really a "logon" key.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/crypto/keyinfo.c

index 0f6a65c6483b3d3ad3b3cb06169a89469b6208d3..0b48aa469453f1db8ce609b2a450e2e8b58e3b74 100644 (file)
@@ -89,12 +89,6 @@ static int validate_user_key(struct fscrypt_info *crypt_info,
                return PTR_ERR(keyring_key);
        down_read(&keyring_key->sem);
 
-       if (keyring_key->type != &key_type_logon) {
-               printk_once(KERN_WARNING
-                               "%s: key type must be logon\n", __func__);
-               res = -ENOKEY;
-               goto out;
-       }
        ukp = user_key_payload_locked(keyring_key);
        if (!ukp) {
                /* key was revoked before we acquired its semaphore */