tpm: tpm_transmit() does not check for minimum buffer size.
PATCH v2 1/1 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
--- drivers/char/tpm/tpm-interface.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/char/tpm/tpm-interface.c +3 -0
@@ -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 ;
Signature · 4 lines
2.7.4 ------------------------------------------------------------------------------
Quoted 2 lines · Jarkko Sakkinen
tpm_transmit()does not check that bufsiz is at leastTPM_HEADER_SIZEbefore accessing data. This commit adds the check and returns-ENOMEM.
-EINVAL
Quoted 1 line
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
Quoted 9 lines · Jason Gunthorpe
Quoted 2 lines · Jarkko Sakkinen
tpm_transmit()does not check that bufsiz is at leastTPM_HEADER_SIZEbefore accessing data. This commit adds the check and returns-ENOMEM.
-EINVALQuoted 1 line
v2: Updated commit msg
After the diffstat, do not commit that to the tree
Duh, right. Thanks.
Quoted 1 line
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