Message ID | ab7f53e6-128b-4c75-8227-b38a10d134b6@web.de (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Mikulas Patocka |
Headers | show |
Series | dm-crypt: Adjustments for crypt_set_keyring_key() | expand |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index d5533b43054e..dae2fe3cb182 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -2621,16 +2621,13 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string down_read(&key->sem); ret = set_key(cc, key); + up_read(&key->sem); + key_put(key); if (ret < 0) { - up_read(&key->sem); - key_put(key); kfree_sensitive(new_key_string); return ret; } - up_read(&key->sem); - key_put(key); - /* clear the flag since following operations may invalidate previously valid key */ clear_bit(DM_CRYPT_KEY_VALID, &cc->flags);