aboutsummaryrefslogtreecommitdiff
path: root/include/linux/compiler_attributes.h
diff options
context:
space:
mode:
authorLino Sanfilippo <LinoSanfilippo@gmx.de>2021-12-20 16:06:35 +0100
committerJarkko Sakkinen <jarkko@kernel.org>2022-01-09 00:18:49 +0200
commiteabad7ba2c752392ae50f24a795093fb115b686d (patch)
tree157c9916bd0eacb2323e68e50564357e0222e41b /include/linux/compiler_attributes.h
parent0aa698787aa2a9e8840987e54ba2982559de6404 (diff)
downloadlinux-eabad7ba2c752392ae50f24a795093fb115b686d.tar.gz
linux-eabad7ba2c752392ae50f24a795093fb115b686d.tar.bz2
linux-eabad7ba2c752392ae50f24a795093fb115b686d.zip
tpm: fix potential NULL pointer access in tpm_del_char_device
Some SPI controller drivers unregister the controller in the shutdown handler (e.g. BCM2835). If such a controller is used with a TPM 2 slave chip->ops may be accessed when it is already NULL: At system shutdown the pre-shutdown handler tpm_class_shutdown() shuts down TPM 2 and sets chip->ops to NULL. Then at SPI controller unregistration tpm_tis_spi_remove() is called and eventually calls tpm_del_char_device() which tries to shut down TPM 2 again. Thereby it accesses chip->ops again: (tpm_del_char_device calls tpm_chip_start which calls tpm_clk_enable which calls chip->ops->clk_enable). Avoid the NULL pointer access by testing if chip->ops is valid and skipping the TPM 2 shutdown procedure in case it is NULL. Cc: stable@vger.kernel.org Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de> Fixes: 39d0099f9439 ("powerpc/pseries: Add shutdown() to vio_driver and vio_bus") Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Tested-by: Stefan Berger <stefanb@linux.ibm.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Diffstat (limited to 'include/linux/compiler_attributes.h')
0 files changed, 0 insertions, 0 deletions