All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tpm: Return the actual size when receiving an unsupported command
@ 2018-06-15 12:18 Ricardo Schwarzmeier
  2018-06-19 12:53 ` Jarkko Sakkinen
  0 siblings, 1 reply; 2+ messages in thread
From: Ricardo Schwarzmeier @ 2018-06-15 12:18 UTC (permalink / raw)
  To: linux-integrity
  Cc: peterhuewe, jarkko.sakkinen, jgg, arnd, gregkh,
	Ricardo Schwarzmeier

The command size is computed for the header anyway.
It can as well indicate the correct number of bytes to read from the driver.

Signed-off-by: Ricardo Schwarzmeier <Ricardo.Schwarzmeier@infineon.com>
---
 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..0923e81505a5 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 header->length;
 	}
 
 	if (bufsiz > TPM_BUFSIZE)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tpm: Return the actual size when receiving an unsupported command
  2018-06-15 12:18 [PATCH] tpm: Return the actual size when receiving an unsupported command Ricardo Schwarzmeier
@ 2018-06-19 12:53 ` Jarkko Sakkinen
  0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2018-06-19 12:53 UTC (permalink / raw)
  To: Ricardo Schwarzmeier; +Cc: linux-integrity, peterhuewe, jgg, arnd, gregkh

On Fri, Jun 15, 2018 at 02:18:21PM +0200, Ricardo Schwarzmeier wrote:
> The command size is computed for the header anyway.
> It can as well indicate the correct number of bytes to read from the driver.
> 
> Signed-off-by: Ricardo Schwarzmeier <Ricardo.Schwarzmeier@infineon.com>
> ---
>  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..0923e81505a5 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 header->length;
>  	}
>  
>  	if (bufsiz > TPM_BUFSIZE)
> -- 
> 2.17.1
> 

Isn't this a regression (just came from one week leave might be
overlooking something)? Should always return either error or response
length. If so, please add the fixes tag.

And please send to linux-integrity and CC to linux-integrity and
linux-kernel.

Thanks anyway.

/Jarkko

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-19 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-15 12:18 [PATCH] tpm: Return the actual size when receiving an unsupported command Ricardo Schwarzmeier
2018-06-19 12:53 ` Jarkko Sakkinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.