diff mbox series

tpm: Fix tpm_send() length calculation

Message ID 20190916073535.25117-1-jarkko.sakkinen@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series tpm: Fix tpm_send() length calculation | expand

Commit Message

Jarkko Sakkinen Sept. 16, 2019, 7:35 a.m. UTC
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(+)

Comments

Jarkko Sakkinen Sept. 16, 2019, 7:46 a.m. UTC | #1
On Mon, Sep 16, 2019 at 10:35:35AM +0300, Jarkko Sakkinen wrote:
> 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>

This is all wrong in all possible ways :-( My excuse is the overnight
flight last night (no sleep). Mimi, I think what you first proposed as
the fix is the right way tho fix it. I'll take some sleep and after that
I'll make a legit commit with fix and a commit message explaining the
root cause.

Please try to ignore this.

/Jarkko
Mimi Zohar Sept. 16, 2019, 12:06 p.m. UTC | #2
On Mon, 2019-09-16 at 10:46 +0300, Jarkko Sakkinen wrote:
> My excuse is the overnight flight last night (no sleep).

Sorry I couldn't make LPC.  Did anyone takes notes of the LPC System
Boot and Security microconference?

thanks,

Mimi
Jerry Snitselaar Sept. 16, 2019, 1:44 p.m. UTC | #3
On Mon Sep 16 19, Mimi Zohar wrote:
>On Mon, 2019-09-16 at 10:46 +0300, Jarkko Sakkinen wrote:
>> My excuse is the overnight flight last night (no sleep).
>
>Sorry I couldn't make LPC.  Did anyone takes notes of the LPC System
>Boot and Security microconference?
>
>thanks,
>
>Mimi
>

There is an etherpad somewhere, but I haven't found a link to it yet,
and there will eventually be videos posted as well.
Piotr Król Sept. 16, 2019, 4:02 p.m. UTC | #4
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512



On 9/16/19 3:44 PM, Jerry Snitselaar wrote:
> On Mon Sep 16 19, Mimi Zohar wrote:

Hi Mimi,

>> On Mon, 2019-09-16 at 10:46 +0300, Jarkko Sakkinen wrote:
>>> My excuse is the overnight flight last night (no sleep).
>> 
>> Sorry I couldn't make LPC.  Did anyone takes notes of the LPC
>> System Boot and Security microconference?
>> 
>> thanks,
>> 
>> Mimi
>> 
> 
> There is an etherpad somewhere, but I haven't found a link to it
> yet, and there will eventually be videos posted as well.
> 

Link to etherpad:
https://etherpad.net/p/LPC2019_System_Boot_and_Security

Best Regards,
- -- 
Piotr Król
Embedded Systems Consultant
GPG: B2EE71E967AA9E4C
https://3mdeb.com | @3mdeb_com
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE4DCbLYWmfoRjKeNLsu5x6WeqnkwFAl1/shoACgkQsu5x6Weq
nkwYGBAAr6PSE1F0Cr3f0izrkmq+RA60aSG1/UHvDrie/kVCsrbFPb7UFYrqePBr
+tw4fUSeVu5+8dSHoKjtT+AXaUo3AO4ChCCI/9Z57gaIu/35Qt+qtGu+Jo6mnK5x
wAI/2Lr+7uO+KL3AmBVkAMta2hpKkMdWv/9Lnd3MvVO4DUnp5QRiVTBCWQvLa8SW
3Z0KNudpz5iRVieRJBXHR5y6ZKXK2jq5PSvsp2UjtLo6oajH0Syh0L2LBbzPp27n
rd7k2sMWlLcTKgRZYETRrkzwHXjKNiUhqaWBjRDVTFQLQoa+8s+O1JI/qDIZb274
6CtypT20xArSZGqGE9GhXEodBUXa9QTOWtHhwe8r/ImO3e42U+mW8xuwA4g4aTju
Axcg4FIAyVRN/Egp5aFncJE6N2f5vfu3thMzSPmPzSrxHA3tc3fSip+UlpMiO5f+
xM+8GIjnbkyK408SGvS577xOgu7TJOlT0y9HCjy1pQlNSlTy6tTEVzgwvM5ntZSv
TGsRzy1j0SIPBJCh4+MNPQk3CyLui4uSAi6G2olu9swS8Qcu+enAYLIfaCtfadMd
F1FKnSYIa0je9Nx3kjOVzl8/1Q4jHIWKTq8YxFftLKGWDxd7yMzLH01W0hkWQfJT
aknsSKTDy5WPh9pFKNxl4znSfFyarSn7t7Ro8IiiZwXtjpooY6Y=
=IjQC
-----END PGP SIGNATURE-----
diff mbox series

Patch

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: