Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1481133 > unrolled thread

[PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size.

Started byJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
First post2016-09-12 12:50 +0200
Last post2016-09-12 22:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size. Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-09-12 12:50 +0200
    Re: [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer  size. Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-09-12 19:40 +0200
      Re: [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer  size. Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-09-12 22:20 +0200

#1481133 — [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size.

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2016-09-12 12:50 +0200
Subject[PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size.
Message-ID<sgwYh-268-7@gated-at.bofh.it>
tpm_transmit() does not check that bufsiz is at least TPM_HEADER_SIZE
before accessing data. This commit adds the check and returns -ENOMEM.

v2: Updated commit msg

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/char/tpm/tpm-interface.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index fd863ff..6a67f7f 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -337,6 +337,9 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const u8 *buf, size_t bufsiz,
 	u32 count, ordinal;
 	unsigned long stop;
 
+	if (bufsiz < TPM_HEADER_SIZE)
+		return -EINVAL;
+
 	if (bufsiz > TPM_BUFSIZE)
 		bufsiz = TPM_BUFSIZE;
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1481726 — Re: [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size.

FromJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Date2016-09-12 19:40 +0200
SubjectRe: [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size.
Message-ID<sgDn5-6mO-59@gated-at.bofh.it>
In reply to#1481133
On Mon, Sep 12, 2016 at 01:43:30PM +0300, Jarkko Sakkinen wrote:
> tpm_transmit() does not check that bufsiz is at least TPM_HEADER_SIZE
> before accessing data. This commit adds the check and returns -ENOMEM.

-EINVAL

> v2: Updated commit msg

After the diffstat, do not commit that to the tree

Jason

[toc] | [prev] | [next] | [standalone]


#1481932 — Re: [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size.

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2016-09-12 22:20 +0200
SubjectRe: [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size.
Message-ID<sgFRT-8ja-7@gated-at.bofh.it>
In reply to#1481726
On Mon, Sep 12, 2016 at 11:32:19AM -0600, Jason Gunthorpe wrote:
> On Mon, Sep 12, 2016 at 01:43:30PM +0300, Jarkko Sakkinen wrote:
> > tpm_transmit() does not check that bufsiz is at least TPM_HEADER_SIZE
> > before accessing data. This commit adds the check and returns -ENOMEM.
> 
> -EINVAL
> 
> > v2: Updated commit msg
> 
> After the diffstat, do not commit that to the tree

Duh, right. Thanks.

> Jason

/Jarkko

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web