提交 36a11029 编写于 作者: R Ricardo Schwarzmeier 提交者: Jarkko Sakkinen

tpm: Return the actual size when receiving an unsupported command

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

Cc: stable@vger.kernel.org
Fixes: 095531f8 ("tpm: return a TPM_RC_COMMAND_CODE response if command is not implemented")
Signed-off-by: NRicardo Schwarzmeier <Ricardo.Schwarzmeier@infineon.com>
Reviewed-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
上级 627448e8
......@@ -450,7 +450,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 |
TSS2_RESMGR_TPM_RC_LAYER);
return bufsiz;
return sizeof(*header);
}
if (bufsiz > TPM_BUFSIZE)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册