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

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

Merge "fs: crypto: Fix memory leak while allocating blk crypto key"

parents b8636f58 0c7cfe49
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -477,9 +477,17 @@ 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)
	else if (ci->ci_owns_key) {
		if (fscrypt_policy_contents_mode(&ci->ci_policy) !=
		    FSCRYPT_MODE_PRIVATE) {
			fscrypt_destroy_prepared_key(&ci->ci_key);

		} else {
#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];
+1 −0
Original line number Diff line number Diff line
@@ -279,6 +279,7 @@ 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;
		memcpy(key_new.bytes, raw_master_key, ci->ci_mode->keysize);

		for (i = 0; i < ARRAY_SIZE(key_new.words); i++)