tpm: Address !chip->auth in tpm_buf_append_name()
authorJarkko Sakkinen <jarkko@kernel.org>
Wed, 3 Jul 2024 15:33:14 +0000 (18:33 +0300)
committerJarkko Sakkinen <jarkko.sakkinen@iki.fi>
Thu, 4 Jul 2024 23:12:27 +0000 (02:12 +0300)
commita61809a33239821d70eba77bd0d6d13c29bbad0d
treed3c7df258ce38eea2a304c3585755c8d7aab4d14
parent25ee48a55fd59c72e0bd46dd9160c2d406b5a497
tpm: Address !chip->auth in tpm_buf_append_name()

Unless tpm_chip_bootstrap() was called by the driver, !chip->auth can
cause a null derefence in tpm_buf_append_name().  Thus, address
!chip->auth in tpm_buf_append_name() and remove the fallback
implementation for !TCG_TPM2_HMAC.

Cc: stable@vger.kernel.org # v6.10+
Reported-by: Stefan Berger <stefanb@linux.ibm.com>
Closes: https://lore.kernel.org/linux-integrity/20240617193408.1234365-1-stefanb@linux.ibm.com/
Fixes: d0a25bb961e6 ("tpm: Add HMAC session name/handle append")
Tested-by: Michael Ellerman <mpe@ellerman.id.au> # ppc
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
drivers/char/tpm/Makefile
drivers/char/tpm/tpm2-sessions.c
include/linux/tpm.h