mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 00:04:15 +08:00
tpm: move the delay_msec increment after sleep in tpm_transmit()
[ Upstream commit9298075697
] Commite2fb992d82
("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: commite2fb992d82
("tpm: add retry logic") Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com> Reviewed-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c1fdafea62
commit
db9d15988a
@ -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)
|
||||
break;
|
||||
delay_msec *= 2;
|
||||
|
||||
if (delay_msec > TPM2_DURATION_LONG) {
|
||||
dev_err(&chip->dev, "TPM is in retry loop\n");
|
||||
break;
|
||||
}
|
||||
tpm_msleep(delay_msec);
|
||||
delay_msec *= 2;
|
||||
memcpy(buf, save, save_size);
|
||||
}
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user