From: Jarkko Sakkinen Date: Tue, 30 Sep 2025 13:02:54 +0000 (+0300) Subject: tpm: Use -EPERM as fallback error code in tpm_ret_to_err X-Git-Url: https://gentwo.org/gitweb/?a=commitdiff_plain;h=7fcf459ac84c42a4ef63a650dccc345602cf4da6;p=linux%2F.git tpm: Use -EPERM as fallback error code in tpm_ret_to_err Using -EFAULT as the tpm_ret_to_err() fallback error code causes makes it incompatible on how trusted keys transmute TPM return codes. Change the fallback as -EPERM in order to gain compatibility with trusted keys. In addition, map TPM_RC_HASH to -EINVAL in order to be compatible with tpm2_seal_trusted() return values. Signed-off-by: Jarkko Sakkinen Reviewed-by: Stefano Garzarella Signed-off-by: Jarkko Sakkinen --- diff --git a/include/linux/tpm.h b/include/linux/tpm.h index 53de9488c509..3d8f7d1ce2b8 100644 --- a/include/linux/tpm.h +++ b/include/linux/tpm.h @@ -456,8 +456,10 @@ static inline ssize_t tpm_ret_to_err(ssize_t ret) return 0; case TPM2_RC_SESSION_MEMORY: return -ENOMEM; + case TPM2_RC_HASH: + return -EINVAL; default: - return -EFAULT; + return -EPERM; } }