@@ -1501,31 +1501,31 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string
if (!key_desc || key_desc == key_string || !strlen(key_desc + 1))
return -EINVAL;
- if (strncmp(key_string, "logon", key_desc - key_string) &&
- strncmp(key_string, "user", key_desc - key_string))
+ if (strncmp(key_string, "logon:", key_desc - key_string + 1) &&
+ strncmp(key_string, "user:", key_desc - key_string + 1))
return -EINVAL;
new_key_string = kstrdup(key_string, GFP_KERNEL);
if (!new_key_string)
return -ENOMEM;
- key = request_key(strncmp(key_string, "user", 4) ? &key_type_logon : &key_type_user,
+ key = request_key(key_string[0] == 'l' ? &key_type_logon : &key_type_user,
key_desc + 1, NULL);
if (IS_ERR(key)) {
kzfree(new_key_string);
return PTR_ERR(key);
}
- ret = key_validate(key);
- if (ret < 0) {
+ rcu_read_lock();
+
+ ukp = user_key_payload(key);
+ if (!ukp) {
+ rcu_read_unlock();
key_put(key);
kzfree(new_key_string);
- return ret;
+ return -EKEYREVOKED;
}
- rcu_read_lock();
-
- ukp = user_key_payload(key);
if (cc->key_size != ukp->datalen) {
rcu_read_unlock();
key_put(key);