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

Commit d88f6a59 authored by Sahitya Tummala's avatar Sahitya Tummala Committed by Neeraj Soni
Browse files

ufs: ufs-qcom: Fix data corruption issue with FBE on F2FS



F2FS uses dun for data encryption/decryption via ICE. Hence,
allow the code to use it if a req has a dun. Without this there
will be data corruption issues when FBE is enabled on F2FS.

Change-Id: I02817c2a8a8f75f70e8a9b0988010a6a13ec1860
Signed-off-by: default avatarSahitya Tummala <stummala@codeaurora.org>
parent fed0967f
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -897,18 +897,17 @@ static int ufs_qcom_crypto_req_setup(struct ufs_hba *hba,
		req = lrbp->cmd->request;
	else
		return 0;
	/*
	 * Right now ICE do not support variable dun but can be
	 * taken as future enhancement
	 * if (bio_dun(req->bio)) {
	 *      dun @bio can be split, so we have to adjust offset
	 *      *dun = bio_dun(req->bio);
	 * } else
	 */

	/* Use request LBA or given dun as the DUN value */
	if (req->bio) {
		if (bio_dun(req->bio)) {
			/* dun @bio can be split, so we have to adjust offset */
			*dun = bio_dun(req->bio);
		} else {
			*dun = req->bio->bi_iter.bi_sector;
			*dun >>= UFS_QCOM_ICE_TR_DATA_UNIT_4_KB;
		}
	}

	ret = ufs_qcom_ice_req_setup(host, lrbp->cmd, cc_index, enable);