Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d9e903c authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "fs: crypto: Maintain reference count for class keys"

parents fd4cdfac 905ba5ec
Loading
Loading
Loading
Loading
+3 −12
Original line number Diff line number Diff line
@@ -477,18 +477,9 @@ static void put_crypt_info(struct fscrypt_info *ci)

	if (ci->ci_direct_key)
		fscrypt_put_direct_key(ci->ci_direct_key);
	else if (ci->ci_owns_key) {
		if (fscrypt_policy_contents_mode(&ci->ci_policy) !=
		    FSCRYPT_MODE_PRIVATE) {
	else if (ci->ci_owns_key)
		fscrypt_destroy_prepared_key(&ci->ci_key);
		} else {
			crypto_free_skcipher(ci->ci_key.tfm);
#ifdef CONFIG_FS_ENCRYPTION_INLINE_CRYPT
			if (ci->ci_key.blk_key)
				kzfree(ci->ci_key.blk_key);
#endif
		}
	}

	key = ci->ci_master_key;
	if (key) {
		struct fscrypt_master_key *mk = key->payload.data[0];
+2 −6
Original line number Diff line number Diff line
@@ -314,7 +314,6 @@ static int setup_v1_file_key_derived(struct fscrypt_info *ci,
	if ((fscrypt_policy_contents_mode(&ci->ci_policy) ==
					  FSCRYPT_MODE_PRIVATE) &&
					  fscrypt_using_inline_encryption(ci)) {
		ci->ci_owns_key = true;
		if (ci->ci_policy.v1.flags &
		    FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32) {
			union {
@@ -353,11 +352,8 @@ static int setup_v1_file_key_derived(struct fscrypt_info *ci,
		for (i = 0; i < ARRAY_SIZE(key_new.words); i++)
			__cpu_to_be32s(&key_new.words[i]);

		err = fscrypt_prepare_inline_crypt_key(&ci->ci_key,
						       key_new.bytes,
						       ci->ci_mode->keysize,
						       false,
						       ci);
		err = setup_v1_file_key_direct(ci, key_new.bytes);

		if (derived_key)
			kzfree(derived_key);