]> www.infradead.org Git - users/dwmw2/linux.git/commit
tpm: tpm_ibm_vtpm: Fix unallocated banks
authorNayna Jain <nayna@linux.ibm.com>
Thu, 11 Jul 2019 16:13:35 +0000 (12:13 -0400)
committerSasha Levin <sashal@kernel.org>
Sun, 25 Aug 2019 14:10:34 +0000 (10:10 -0400)
commit591eb1c6e27f7a792172bc6d41d7fddfbf1bfd0b
tree08d33f9cc39473cf68ddc6efd1256e006f4efbc4
parent382cbf20a3877e5dad9ae82c784e9cdb8e2a1d4f
tpm: tpm_ibm_vtpm: Fix unallocated banks

[ Upstream commit fa4f99c05320eb28bf6ba52a9adf64d888da1f9e ]

The nr_allocated_banks and allocated banks are initialized as part of
tpm_chip_register. Currently, this is done as part of auto startup
function. However, some drivers, like the ibm vtpm driver, do not run
auto startup during initialization. This results in uninitialized memory
issue and causes a kernel panic during boot.

This patch moves the pcr allocation outside the auto startup function
into tpm_chip_register. This ensures that allocated banks are initialized
in any case.

Fixes: 879b589210a9 ("tpm: retrieve digest size of unknown algorithms with PCR read")
Reported-by: Michal Suchanek <msuchanek@suse.de>
Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
Tested-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
Tested-by: Michal Suchánek <msuchanek@suse.de>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/char/tpm/tpm-chip.c
drivers/char/tpm/tpm.h
drivers/char/tpm/tpm1-cmd.c
drivers/char/tpm/tpm2-cmd.c