summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorRicardo Schwarzmeier <Ricardo.Schwarzmeier@infineon.com>2018-06-26 18:31:45 +0300
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2018-07-28 17:03:11 +0300
commit36a11029b07ee30bdc4553274d0efea645ed9d91 (patch)
treea0905a4c425cd3c4ce19357b130783a24cc4c977 /drivers/char
parent627448e85c766587f6fdde1ea3886d6615081c77 (diff)
downloadlinux-36a11029b07ee30bdc4553274d0efea645ed9d91.tar.xz
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: 095531f891e6 ("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>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm-interface.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index 31b86e027f9d..3a3a7a548a85 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -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)