aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2014-05-09 07:23:10 -0400
committerPeter Huewe <peterhuewe@gmx.de>2014-07-29 17:10:55 -0400
commit3e14d83ef94a5806a865b85b513b4e891923c19b (patch)
treef5f24b21204faa237dfba9069703e6f45d66ddd8 /drivers/char
parentb49e1043c48dac23f64fba684d31c4a96c1ffaa0 (diff)
tpm: missing tpm_chip_put in tpm_get_random()
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. Cc: <stable@vger.kernel.org> # 3.7+ Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm-interface.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index d175fb8e719a..bef6cceffc3a 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -991,13 +991,13 @@ int tpm_get_random(u32 chip_num, u8 *out, size_t max)
991 int err, total = 0, retries = 5; 991 int err, total = 0, retries = 5;
992 u8 *dest = out; 992 u8 *dest = out;
993 993
994 if (!out || !num_bytes || max > TPM_MAX_RNG_DATA)
995 return -EINVAL;
996
994 chip = tpm_chip_find_get(chip_num); 997 chip = tpm_chip_find_get(chip_num);
995 if (chip == NULL) 998 if (chip == NULL)
996 return -ENODEV; 999 return -ENODEV;
997 1000
998 if (!out || !num_bytes || max > TPM_MAX_RNG_DATA)
999 return -EINVAL;
1000
1001 do { 1001 do {
1002 tpm_cmd.header.in = tpm_getrandom_header; 1002 tpm_cmd.header.in = tpm_getrandom_header;
1003 tpm_cmd.params.getrandom_in.num_bytes = cpu_to_be32(num_bytes); 1003 tpm_cmd.params.getrandom_in.num_bytes = cpu_to_be32(num_bytes);
@@ -1016,6 +1016,7 @@ int tpm_get_random(u32 chip_num, u8 *out, size_t max)
1016 num_bytes -= recd; 1016 num_bytes -= recd;
1017 } while (retries-- && total < max); 1017 } while (retries-- && total < max);
1018 1018
1019 tpm_chip_put(chip);
1019 return total ? total : -EIO; 1020 return total ? total : -EIO;
1020} 1021}
1021EXPORT_SYMBOL_GPL(tpm_get_random); 1022EXPORT_SYMBOL_GPL(tpm_get_random);