mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
tpm: Return the actual size when receiving an unsupported command
commit36a11029b0upstream. 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:095531f891("tpm: return a TPM_RC_COMMAND_CODE response if command is not implemented") Signed-off-by: Ricardo Schwarzmeier <Ricardo.Schwarzmeier@infineon.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ba0797a801
commit
61ec14f42c
@@ -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 |
|
||||
TSS2_RESMGR_TPM_RC_LAYER);
|
||||
return bufsiz;
|
||||
return sizeof(*header);
|
||||
}
|
||||
|
||||
if (bufsiz > TPM_BUFSIZE)
|
||||
|
||||
Reference in New Issue
Block a user