Commit b64b3b46 authored by Ricardo Schwarzmeier's avatar Ricardo Schwarzmeier Committed by Greg Kroah-Hartman
Browse files

tpm: Return the actual size when receiving an unsupported command

commit 36a11029 upstream.

The userpace expects to read the number of bytes stated in the header.
Returning the size of the buffer instead would be unexpected.

Fixes: 095531f8

 ("tpm: return a TPM_RC_COMMAND_CODE response if command is not implemented")
Signed-off-by: default avatarRicardo Schwarzmeier <>
Reviewed-by: default avatarJarkko Sakkinen <>
Signed-off-by: default avatarJarkko Sakkinen <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent d07d4e8b
......@@ -423,7 +423,7 @@ static ssize_t tpm_try_transmit(struct tpm_chip *chip,
header->tag = cpu_to_be16(TPM2_ST_NO_SESSIONS);
header->return_code = cpu_to_be32(TPM2_RC_COMMAND_CODE |
return bufsiz;
return sizeof(*header);
if (bufsiz > TPM_BUFSIZE)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment