diff options
author | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2014-05-09 15:23:10 +0400 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2014-09-17 18:55:02 +0400 |
commit | a4ed6bc99bb00d7202cb1e0ef99095d39d76d200 (patch) | |
tree | 2187a01431d59e32de208f319ba6e27c82a64028 /drivers/char | |
parent | 2617e71a8abc3fe12f44ed36e1cad3820a75d37c (diff) | |
download | linux-a4ed6bc99bb00d7202cb1e0ef99095d39d76d200.tar.xz |
tpm: missing tpm_chip_put in tpm_get_random()
commit 3e14d83ef94a5806a865b85b513b4e891923c19b upstream.
Regression in 41ab999c. Call to tpm_chip_put is missing. This
will cause TPM device driver not to unload if tmp_get_random()
is called.
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/tpm/tpm.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index e3c974a6c522..334b9ef1bb1d 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c @@ -1423,13 +1423,13 @@ int tpm_get_random(u32 chip_num, u8 *out, size_t max) int err, total = 0, retries = 5; u8 *dest = out; + if (!out || !num_bytes || max > TPM_MAX_RNG_DATA) + return -EINVAL; + chip = tpm_chip_find_get(chip_num); if (chip == NULL) return -ENODEV; - if (!out || !num_bytes || max > TPM_MAX_RNG_DATA) - return -EINVAL; - do { tpm_cmd.header.in = tpm_getrandom_header; tpm_cmd.params.getrandom_in.num_bytes = cpu_to_be32(num_bytes); @@ -1448,6 +1448,7 @@ int tpm_get_random(u32 chip_num, u8 *out, size_t max) num_bytes -= recd; } while (retries-- && total < max); + tpm_chip_put(chip); return total ? total : -EIO; } EXPORT_SYMBOL_GPL(tpm_get_random); |