|
@@ -1190,6 +1190,10 @@ int tpm_get_random(struct tpm_chip *chip, u8 *out, size_t max)
|
|
break;
|
|
break;
|
|
|
|
|
|
recd = be32_to_cpu(tpm_cmd.params.getrandom_out.rng_data_len);
|
|
recd = be32_to_cpu(tpm_cmd.params.getrandom_out.rng_data_len);
|
|
|
|
+ if (recd > num_bytes) {
|
|
|
|
+ total = -EFAULT;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
|
|
rlength = be32_to_cpu(tpm_cmd.header.out.length);
|
|
rlength = be32_to_cpu(tpm_cmd.header.out.length);
|
|
if (rlength < offsetof(struct tpm_getrandom_out, rng_data) +
|
|
if (rlength < offsetof(struct tpm_getrandom_out, rng_data) +
|