Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jarkko Sakkinen and committed by
Peter Huewe
3e14d83e b49e1043

+4 -3
+4 -3
drivers/char/tpm/tpm-interface.c
··· 991 991 int err, total = 0, retries = 5; 992 992 u8 *dest = out; 993 993 994 + if (!out || !num_bytes || max > TPM_MAX_RNG_DATA) 995 + return -EINVAL; 996 + 994 997 chip = tpm_chip_find_get(chip_num); 995 998 if (chip == NULL) 996 999 return -ENODEV; 997 - 998 - if (!out || !num_bytes || max > TPM_MAX_RNG_DATA) 999 - return -EINVAL; 1000 1000 1001 1001 do { 1002 1002 tpm_cmd.header.in = tpm_getrandom_header; ··· 1016 1016 num_bytes -= recd; 1017 1017 } while (retries-- && total < max); 1018 1018 1019 + tpm_chip_put(chip); 1019 1020 return total ? total : -EIO; 1020 1021 } 1021 1022 EXPORT_SYMBOL_GPL(tpm_get_random);