Skip to content

Commit 808af91

Browse files
ebiggersgregkh
authored andcommitted
scsi: ufs: qcom: Fix crypto key eviction
commit 7a0905c upstream. Commit 56541c7 ("scsi: ufs: ufs-qcom: Switch to the new ICE API") introduced an incorrect check of the algorithm ID into the key eviction path, and thus qcom_ice_evict_key() is no longer ever called. Fix it. Fixes: 56541c7 ("scsi: ufs: ufs-qcom: Switch to the new ICE API") Cc: [email protected] Cc: Abel Vesa <[email protected]> Signed-off-by: Eric Biggers <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f7e3935 commit 808af91

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

drivers/ufs/host/ufs-qcom.c

+8-10
Original file line numberDiff line numberDiff line change
@@ -155,23 +155,21 @@ static int ufs_qcom_ice_program_key(struct ufs_hba *hba,
155155
{
156156
struct ufs_qcom_host *host = ufshcd_get_variant(hba);
157157
union ufs_crypto_cap_entry cap;
158-
bool config_enable =
159-
cfg->config_enable & UFS_CRYPTO_CONFIGURATION_ENABLE;
158+
159+
if (!(cfg->config_enable & UFS_CRYPTO_CONFIGURATION_ENABLE))
160+
return qcom_ice_evict_key(host->ice, slot);
160161

161162
/* Only AES-256-XTS has been tested so far. */
162163
cap = hba->crypto_cap_array[cfg->crypto_cap_idx];
163164
if (cap.algorithm_id != UFS_CRYPTO_ALG_AES_XTS ||
164165
cap.key_size != UFS_CRYPTO_KEY_SIZE_256)
165166
return -EOPNOTSUPP;
166167

167-
if (config_enable)
168-
return qcom_ice_program_key(host->ice,
169-
QCOM_ICE_CRYPTO_ALG_AES_XTS,
170-
QCOM_ICE_CRYPTO_KEY_SIZE_256,
171-
cfg->crypto_key,
172-
cfg->data_unit_size, slot);
173-
else
174-
return qcom_ice_evict_key(host->ice, slot);
168+
return qcom_ice_program_key(host->ice,
169+
QCOM_ICE_CRYPTO_ALG_AES_XTS,
170+
QCOM_ICE_CRYPTO_KEY_SIZE_256,
171+
cfg->crypto_key,
172+
cfg->data_unit_size, slot);
175173
}
176174

177175
#else

0 commit comments

Comments
 (0)