Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebfd7532 authored by Jarkko Sakkinen's avatar Jarkko Sakkinen
Browse files

tpm: add check for minimum buffer size in tpm_transmit()



tpm_transmit() does not check that bufsiz is at least TPM_HEADER_SIZE
before accessing data. This commit adds this check and returns -EINVAL
if it fails.

Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
parent 0014777f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;