]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/crypto/crypto.c
Merge tag 'y2038-vfs' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground
[linux.git] / fs / crypto / crypto.c
index 7502c1f0ede9e98c8437475b228754824ef0de6a..32a7ad0098cc28b7739d225e52d4898d812f939b 100644 (file)
@@ -141,7 +141,7 @@ void fscrypt_generate_iv(union fscrypt_iv *iv, u64 lblk_num,
        memset(iv, 0, ci->ci_mode->ivsize);
        iv->lblk_num = cpu_to_le64(lblk_num);
 
-       if (ci->ci_flags & FSCRYPT_POLICY_FLAG_DIRECT_KEY)
+       if (fscrypt_is_direct_key_policy(&ci->ci_policy))
                memcpy(iv->nonce, ci->ci_nonce, FS_KEY_DERIVATION_NONCE_SIZE);
 
        if (ci->ci_essiv_tfm != NULL)
@@ -478,6 +478,8 @@ void fscrypt_msg(const struct inode *inode, const char *level,
  */
 static int __init fscrypt_init(void)
 {
+       int err = -ENOMEM;
+
        /*
         * Use an unbound workqueue to allow bios to be decrypted in parallel
         * even when they happen to complete on the same CPU.  This sacrifices
@@ -500,13 +502,19 @@ static int __init fscrypt_init(void)
        if (!fscrypt_info_cachep)
                goto fail_free_ctx;
 
+       err = fscrypt_init_keyring();
+       if (err)
+               goto fail_free_info;
+
        return 0;
 
+fail_free_info:
+       kmem_cache_destroy(fscrypt_info_cachep);
 fail_free_ctx:
        kmem_cache_destroy(fscrypt_ctx_cachep);
 fail_free_queue:
        destroy_workqueue(fscrypt_read_workqueue);
 fail:
-       return -ENOMEM;
+       return err;
 }
 late_initcall(fscrypt_init)