[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180626153145.7408-1-Ricardo.Schwarzmeier@infineon.com>
Date: Tue, 26 Jun 2018 17:31:45 +0200
From: Ricardo Schwarzmeier <Ricardo.Schwarzmeier@...ineon.com>
To: <linux-integrity@...r.kernel.org>
CC: <linux-kernel@...r.kernel.org>, <peterhuewe@....de>,
<jarkko.sakkinen@...ux.intel.com>, <jgg@...pe.ca>, <arnd@...db.de>,
<gregkh@...uxfoundation.org>,
Ricardo Schwarzmeier <Ricardo.Schwarzmeier@...ineon.com>
Subject: [PATCH v5] 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.
Fixes: 095531f891e6 ("tpm: return a TPM_RC_COMMAND_CODE response if command is not implemented")
Signed-off-by: Ricardo Schwarzmeier <Ricardo.Schwarzmeier@...ineon.com>
---
v2: *Add fixes tag
v3: *Avoid endianness problem
*Make commit message more clear
v4: *Fix commit message style
v5: *Add change log
drivers/char/tpm/tpm-interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index e32f6e85dc6d..7f2e2d54894d 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -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)
--
2.17.1
Powered by blists - more mailing lists