public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tpm: Fix tpm_send() length calculation
@ 2019-09-16  7:35 Jarkko Sakkinen
  2019-09-16  7:46 ` Jarkko Sakkinen
  2019-09-16  9:52 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Jarkko Sakkinen @ 2019-09-16  7:35 UTC (permalink / raw)
  To: linux-integrity
  Cc: Jarkko Sakkinen, Mimi Zohar, stable, Peter Huewe, Jason Gunthorpe,
	Arnd Bergmann, Greg Kroah-Hartman, open list

Set the size of the tpm_buf correctly. Now it is set to the header
length by tpm_buf_init().

Reported-by: Mimi Zohar <zohar@linux.ibm.com>
Cc: stable@vger.kernel.org
Fixes: 412eb585587a ("use tpm_buf in tpm_transmit_cmd() as the IO parameter")
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/char/tpm/tpm-interface.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index d9ace5480665..4aa7e7f91139 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -363,6 +363,8 @@ int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen)
 		goto out;
 
 	memcpy(buf.data, cmd, buflen);
+	buf.length = buflen;
+
 	rc = tpm_transmit_cmd(chip, &buf, 0, "attempting to a send a command");
 	tpm_buf_destroy(&buf);
 out:
-- 
2.20.1


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

end of thread, other threads:[~2019-09-16  9:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-16  7:35 [PATCH] tpm: Fix tpm_send() length calculation Jarkko Sakkinen
2019-09-16  7:46 ` Jarkko Sakkinen
2019-09-16  9:52 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox