Skip to content

Commit 6b07d30

Browse files
Peter Huewexjamesmorris
authored andcommitted
TPM: Call tpm_transmit with correct size
This patch changes the call of tpm_transmit by supplying the size of the userspace buffer instead of TPM_BUFSIZE. This got assigned CVE-2011-1161. [The first hunk didn't make sense given one could expect way less data than TPM_BUFSIZE, so added tpm_transmit boundary check over bufsiz instead The last parameter of tpm_transmit() reflects the amount of data expected from the device, and not the buffer size being supplied to it. It isn't ideal to parse it directly, so we just set it to the maximum the input buffer can handle and let the userspace API to do such job.] Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com> Cc: Stable Kernel <stable@kernel.org> Signed-off-by: James Morris <jmorris@namei.org>
1 parent de69113 commit 6b07d30

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎drivers/char/tpm/tpm.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@ static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
383383
u32 count, ordinal;
384384
unsigned long stop;
385385

386+
if (bufsiz > TPM_BUFSIZE)
387+
bufsiz = TPM_BUFSIZE;
388+
386389
count = be32_to_cpu(*((__be32 *) (buf + 2)));
387390
ordinal = be32_to_cpu(*((__be32 *) (buf + 6)));
388391
if (count == 0)

0 commit comments

Comments
 (0)