Commit db9d1598 authored by Nayna Jain's avatar Nayna Jain Committed by Greg Kroah-Hartman

tpm: move the delay_msec increment after sleep in tpm_transmit()

[ Upstream commit 92980756 ]

Commit e2fb992d ("tpm: add retry logic") introduced a new loop to
handle the TPM2_RC_RETRY error. The loop retries the command after
sleeping for the specified time, which is incremented exponentially in
every iteration.

Unfortunately, the loop doubles the time before sleeping, causing the
initial sleep to be doubled. This patch fixes the initial sleep time.

Fixes: commit e2fb992d ("tpm: add retry logic")
Signed-off-by: default avatarNayna Jain <>
Reviewed-by: default avatarMimi Zohar <>
Tested-by: default avatarJarkko Sakkinen <>
Reviewed-by: default avatarJarkko Sakkinen <>
Signed-off-by: default avatarJarkko Sakkinen <>
Signed-off-by: default avatarSasha Levin <>
parent c1fdafea
......@@ -611,12 +611,13 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
rc = be32_to_cpu(header->return_code);
if (rc != TPM2_RC_RETRY)
delay_msec *= 2;
if (delay_msec > TPM2_DURATION_LONG) {
dev_err(&chip->dev, "TPM is in retry loop\n");
delay_msec *= 2;
memcpy(buf, save, save_size);
return ret;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment