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

Commit 323195c9 authored by Amir Samuelov's avatar Amir Samuelov
Browse files

pft: fix pft_allow_merge_bio() to check if key is loaded



Encrypted BIOs are created only when file encryption is enabled,
which happens only when key is loaded.
If key is not loaded then non-encrypted BIOs can safely merge.
This fix makes PFT hook silent before activation
and fix Factory-Data-Reset (FDR) issue.

Change-Id: I7763ee540f157fe590f400467dbf73b62adcf407
Signed-off-by: default avatarAmir Samuelov <amirs@codeaurora.org>
parent c5564588
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -805,6 +805,13 @@ bool pft_allow_merge_bio(struct bio *bio1, struct bio *bio2)
	if (!pft_is_ready())
		return true;

	/*
	 * Encrypted BIOs are created only when file encryption is enabled,
	 * which happens only when key is loaded.
	 */
	if (pft_dev->state != PFT_STATE_KEY_LOADED)
		return true;

	ret = pft_get_key_index(bio1, &key_index1,
				&is_encrypted1, &is_inplace);
	if (ret)