summaryrefslogtreecommitdiff
path: root/drivers/char/tpm/tpm2-cmd.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2018-03-08 17:52:08 +0300
committerThomas Gleixner <tglx@linutronix.de>2018-03-08 17:52:08 +0300
commit422caa5f7a455920369039d04c6070eb50d6146b (patch)
tree8667d9587c412ee25660184f6e943ed10e445bc0 /drivers/char/tpm/tpm2-cmd.c
parent8a331f4a0863bea758561c921b94b4d28f7c4029 (diff)
parentb3b7c4795ccab5be71f080774c45bbbcc75c2aaf (diff)
downloadlinux-422caa5f7a455920369039d04c6070eb50d6146b.tar.xz
Merge branch 'ras/urgent' into ras/core
Pick up urgent fixes to apply further development changes.
Diffstat (limited to 'drivers/char/tpm/tpm2-cmd.c')
-rw-r--r--drivers/char/tpm/tpm2-cmd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
index c17e75348a99..a700f8f9ead7 100644
--- 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);