|
@@ -1534,18 +1534,18 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string
|
|
return PTR_ERR(key);
|
|
return PTR_ERR(key);
|
|
}
|
|
}
|
|
|
|
|
|
- rcu_read_lock();
|
|
|
|
|
|
+ down_read(&key->sem);
|
|
|
|
|
|
ukp = user_key_payload(key);
|
|
ukp = user_key_payload(key);
|
|
if (!ukp) {
|
|
if (!ukp) {
|
|
- rcu_read_unlock();
|
|
|
|
|
|
+ up_read(&key->sem);
|
|
key_put(key);
|
|
key_put(key);
|
|
kzfree(new_key_string);
|
|
kzfree(new_key_string);
|
|
return -EKEYREVOKED;
|
|
return -EKEYREVOKED;
|
|
}
|
|
}
|
|
|
|
|
|
if (cc->key_size != ukp->datalen) {
|
|
if (cc->key_size != ukp->datalen) {
|
|
- rcu_read_unlock();
|
|
|
|
|
|
+ up_read(&key->sem);
|
|
key_put(key);
|
|
key_put(key);
|
|
kzfree(new_key_string);
|
|
kzfree(new_key_string);
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
@@ -1553,7 +1553,7 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string
|
|
|
|
|
|
memcpy(cc->key, ukp->data, cc->key_size);
|
|
memcpy(cc->key, ukp->data, cc->key_size);
|
|
|
|
|
|
- rcu_read_unlock();
|
|
|
|
|
|
+ up_read(&key->sem);
|
|
key_put(key);
|
|
key_put(key);
|
|
|
|
|
|
/* clear the flag since following operations may invalidate previously valid key */
|
|
/* clear the flag since following operations may invalidate previously valid key */
|