[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1473677010-13737-1-git-send-email-jarkko.sakkinen@linux.intel.com>
Date: Mon, 12 Sep 2016 13:43:30 +0300
From: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To: Peter Huewe <peterhuewe@....de>
Cc: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
Marcel Selhorst <tpmdd@...horst.net>,
Jason Gunthorpe <jgunthorpe@...idianresearch.com>,
tpmdd-devel@...ts.sourceforge.net (moderated list:TPM DEVICE DRIVER),
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH v2] tpm: tpm_transmit() does not check for minimum buffer size.
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@...ux.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
Powered by blists - more mailing lists