All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size.
@ 2016-09-12 10:43 ` Jarkko Sakkinen
  0 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2016-09-12 10:43 UTC (permalink / raw)
  To: Peter Huewe
  Cc: Jarkko Sakkinen, Marcel Selhorst, Jason Gunthorpe,
	moderated list:TPM DEVICE DRIVER, open list

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

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

* [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size.
@ 2016-09-12 10:43 ` Jarkko Sakkinen
  0 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2016-09-12 10:43 UTC (permalink / raw)
  To: Peter Huewe; +Cc: moderated list:TPM DEVICE DRIVER, open list

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-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 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


------------------------------------------------------------------------------

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

* Re: [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size.
@ 2016-09-12 17:32   ` Jason Gunthorpe
  0 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2016-09-12 17:32 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: Peter Huewe, Marcel Selhorst, moderated list:TPM DEVICE DRIVER,
	open list

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

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

* Re: [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size.
@ 2016-09-12 17:32   ` Jason Gunthorpe
  0 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2016-09-12 17:32 UTC (permalink / raw)
  To: Jarkko Sakkinen; +Cc: moderated list:TPM DEVICE DRIVER, open list

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

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. http://sdm.link/zohodev2dev

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

* Re: [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size.
@ 2016-09-12 20:16     ` Jarkko Sakkinen
  0 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2016-09-12 20:16 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Peter Huewe, Marcel Selhorst, moderated list:TPM DEVICE DRIVER,
	open list

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

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

* Re: [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size.
@ 2016-09-12 20:16     ` Jarkko Sakkinen
  0 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2016-09-12 20:16 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: moderated list:TPM DEVICE DRIVER, open list

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

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. http://sdm.link/zohodev2dev

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

end of thread, other threads:[~2016-09-12 20:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-12 10:43 [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size Jarkko Sakkinen
2016-09-12 10:43 ` Jarkko Sakkinen
2016-09-12 17:32 ` Jason Gunthorpe
2016-09-12 17:32   ` Jason Gunthorpe
2016-09-12 20:16   ` Jarkko Sakkinen
2016-09-12 20:16     ` 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.