git.samba.org
/
sfrench
/
cifs-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
tpm: fix potential buffer overruns caused by bit glitches on the bus
[sfrench/cifs-2.6.git]
/
drivers
/
char
/
tpm
/
tpm2-cmd.c
diff --git
a/drivers/char/tpm/tpm2-cmd.c
b/drivers/char/tpm/tpm2-cmd.c
index c17e75348a991e355236f2040f931e940541049f..a700f8f9ead797df39de4b5ef946fb5c2c65c95b 100644
(file)
--- a/
drivers/char/tpm/tpm2-cmd.c
+++ b/
drivers/char/tpm/tpm2-cmd.c
@@
-683,6
+683,10
@@
static int tpm2_unseal_cmd(struct tpm_chip *chip,
if (!rc) {
data_len = be16_to_cpup(
(__be16 *) &buf.data[TPM_HEADER_SIZE + 4]);
+ if (data_len < MIN_KEY_SIZE || data_len > MAX_KEY_SIZE + 1) {
+ rc = -EFAULT;
+ goto out;
+ }
rlength = be32_to_cpu(((struct tpm2_cmd *)&buf)
->header.out.length);