]> git.baikalelectronics.ru Git - kernel.git/commit
tpm: fix: sanitized code paths in tpm_chip_register()
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Wed, 18 Mar 2015 06:17:14 +0000 (08:17 +0200)
committerPeter Huewe <peterhuewe@gmx.de>
Wed, 18 Mar 2015 21:43:05 +0000 (22:43 +0100)
commit61d9ffd40b6da6ec2102448cef5c2a329d0c8a91
tree09dbec71809f26be149057226988a07f713c2639
parent05519ecac953b96a2d984642744f0d9dfca06e3a
tpm: fix: sanitized code paths in tpm_chip_register()

I started to work with PPI interface so that it would be available
under character device sysfs directory and realized that chip
registeration was still too messy.

In TPM 1.x in some rare scenarios (errors that almost never occur)
wrong order in deinitialization steps was taken in teardown. I
reproduced these scenarios by manually inserting error codes in the
place of the corresponding function calls.

The key problem is that the teardown is messy with two separate code
paths (this was inherited when moving code from tpm-interface.c).

Moved TPM 1.x specific register/unregister functionality to own helper
functions and added single code path for teardown in tpm_chip_register().
Now the code paths have been fixed and it should be easier to review
later on this part of the code.

Cc: <stable@vger.kernel.org>
Fixes: ee2643fccf44 ("tpm: TPM 2.0 baseline support")
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Scot Doyle <lkml14@scotdoyle.com>
Reviewed-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
drivers/char/tpm/tpm-chip.c