All of lore.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 ` [PATCH] tpm: Fix tpm_send() length calculation kbuild test robot
  0 siblings, 2 replies; 6+ 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] 6+ messages in thread

* Re: [PATCH] tpm: Fix tpm_send() length calculation
  2019-09-16  7:35 [PATCH] tpm: Fix tpm_send() length calculation Jarkko Sakkinen
@ 2019-09-16  7:46 ` Jarkko Sakkinen
  2019-09-16 12:06   ` LPC System Boot and Security Microconference (subject change) Mimi Zohar
  2019-09-16  9:52 ` [PATCH] tpm: Fix tpm_send() length calculation kbuild test robot
  1 sibling, 1 reply; 6+ messages in thread
From: Jarkko Sakkinen @ 2019-09-16  7:46 UTC (permalink / raw)
  To: linux-integrity
  Cc: Mimi Zohar, stable, Peter Huewe, Jason Gunthorpe, Arnd Bergmann,
	Greg Kroah-Hartman, open list

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

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

* Re: [PATCH] tpm: Fix tpm_send() length calculation
  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
  1 sibling, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2019-09-16  9:52 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: kbuild-all, linux-integrity, Jarkko Sakkinen, Mimi Zohar, stable,
	Peter Huewe, Jason Gunthorpe, Arnd Bergmann, Greg Kroah-Hartman,
	open list

[-- Attachment #1: Type: text/plain, Size: 2036 bytes --]

Hi Jarkko,

I love your patch! Yet something to improve:

[auto build test ERROR on jss-tpmdd/next]
[cannot apply to v5.3 next-20190915]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jarkko-Sakkinen/tpm-Fix-tpm_send-length-calculation/20190916-162814
base:   git://git.infradead.org/users/jjs/linux-tpmdd next
config: x86_64-randconfig-a004-201937 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-11) 7.4.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/char/tpm/tpm-interface.c: In function 'tpm_send':
>> drivers/char/tpm/tpm-interface.c:366:5: error: 'struct tpm_buf' has no member named 'length'
     buf.length = buflen;
        ^

vim +366 drivers/char/tpm/tpm-interface.c

   343	
   344	/**
   345	 * tpm_send - send a TPM command
   346	 * @chip:	a &struct tpm_chip instance, %NULL for the default chip
   347	 * @cmd:	a TPM command buffer
   348	 * @buflen:	the length of the TPM command buffer
   349	 *
   350	 * Return: same as with tpm_transmit_cmd()
   351	 */
   352	int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen)
   353	{
   354		struct tpm_buf buf;
   355		int rc;
   356	
   357		chip = tpm_find_get_ops(chip);
   358		if (!chip)
   359			return -ENODEV;
   360	
   361		rc = tpm_buf_init(&buf, 0, 0);
   362		if (rc)
   363			goto out;
   364	
   365		memcpy(buf.data, cmd, buflen);
 > 366		buf.length = buflen;
   367	
   368		rc = tpm_transmit_cmd(chip, &buf, 0, "attempting to a send a command");
   369		tpm_buf_destroy(&buf);
   370	out:
   371		tpm_put_ops(chip);
   372		return rc;
   373	}
   374	EXPORT_SYMBOL_GPL(tpm_send);
   375	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25235 bytes --]

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

* Re: LPC System Boot and Security Microconference  (subject change)
  2019-09-16  7:46 ` Jarkko Sakkinen
@ 2019-09-16 12:06   ` Mimi Zohar
  2019-09-16 13:44     ` Jerry Snitselaar
  0 siblings, 1 reply; 6+ messages in thread
From: Mimi Zohar @ 2019-09-16 12:06 UTC (permalink / raw)
  To: Jarkko Sakkinen, linux-integrity
  Cc: Peter Huewe, Jason Gunthorpe, Jerry Snitselaar, Piotr Król

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


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

* Re: LPC System Boot and Security Microconference  (subject change)
  2019-09-16 12:06   ` LPC System Boot and Security Microconference (subject change) Mimi Zohar
@ 2019-09-16 13:44     ` Jerry Snitselaar
  2019-09-16 16:02       ` Piotr Król
  0 siblings, 1 reply; 6+ messages in thread
From: Jerry Snitselaar @ 2019-09-16 13:44 UTC (permalink / raw)
  To: Mimi Zohar
  Cc: Jarkko Sakkinen, linux-integrity, Peter Huewe, Jason Gunthorpe,
	Piotr Król

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.


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

* Re: LPC System Boot and Security Microconference (subject change)
  2019-09-16 13:44     ` Jerry Snitselaar
@ 2019-09-16 16:02       ` Piotr Król
  0 siblings, 0 replies; 6+ messages in thread
From: Piotr Król @ 2019-09-16 16:02 UTC (permalink / raw)
  To: Jerry Snitselaar, Mimi Zohar
  Cc: Jarkko Sakkinen, linux-integrity, Peter Huewe, Jason Gunthorpe

-----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-----

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

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

Thread overview: 6+ 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 12:06   ` LPC System Boot and Security Microconference (subject change) Mimi Zohar
2019-09-16 13:44     ` Jerry Snitselaar
2019-09-16 16:02       ` Piotr Król
2019-09-16  9:52 ` [PATCH] tpm: Fix tpm_send() length calculation kbuild test robot

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.