OrangePi_CM5/drivers/char/tpm
Patrick Williams 05026c4e94 tpm: fix NPE on probe for missing device
commit 84cc69589700b90a4c8d27b481a51fce8cca6051 upstream.

When using the tpm_tis-spi driver on a system missing the physical TPM,
a null pointer exception was observed.

    [    0.938677] Unable to handle kernel NULL pointer dereference at virtual address 00000004
    [    0.939020] pgd = 10c753cb
    [    0.939237] [00000004] *pgd=00000000
    [    0.939808] Internal error: Oops: 5 [#1] SMP ARM
    [    0.940157] CPU: 0 PID: 48 Comm: kworker/u4:1 Not tainted 5.15.10-dd1e40c #1
    [    0.940364] Hardware name: Generic DT based system
    [    0.940601] Workqueue: events_unbound async_run_entry_fn
    [    0.941048] PC is at tpm_tis_remove+0x28/0xb4
    [    0.941196] LR is at tpm_tis_core_init+0x170/0x6ac

This is due to an attempt in 'tpm_tis_remove' to use the drvdata, which
was not initialized in 'tpm_tis_core_init' prior to the first error.

Move the initialization of drvdata earlier so 'tpm_tis_remove' has
access to it.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Fixes: 79ca6f74dae0 ("tpm: fix Atmel TPM crash caused by too frequent queries")
Cc: stable@vger.kernel.org
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-27 10:54:24 +01:00
..
eventlog tpm: vtpm_proxy: Avoid reading host log when using a virtual device 2021-05-11 14:47:35 +02:00
st33zp24
…
Kconfig tpm: tis: add support for MMIO TPM on SynQuacer 2020-10-02 00:21:02 +03:00
Makefile tpm: tis: add support for MMIO TPM on SynQuacer 2020-10-02 00:21:02 +03:00
tpm-chip.c tpm: Unify the mismatching TPM space buffer sizes 2020-07-24 09:26:23 +03:00
tpm-dev-common.c
…
tpm-dev.c
…
tpm-dev.h
…
tpm-interface.c
…
tpm-sysfs.c tpm: use %*ph to print small buffer 2020-10-02 00:21:03 +03:00
tpm.h KEYS: trusted: Reserve TPM for seal and unseal operations 2021-03-04 11:38:29 +01:00
tpm1-cmd.c
…
tpm2-cmd.c tpm: fix error return code in tpm2_get_cc_attrs_tbl() 2021-05-19 10:12:51 +02:00
tpm2-space.c tpm: Check for integer overflow in tpm2_map_response_body() 2021-11-18 14:03:38 +01:00
tpm_atmel.c
…
tpm_atmel.h
…
tpm_crb.c
…
tpm_ftpm_tee.c tpm_ftpm_tee: Free and unregister TEE shared memory during kexec 2021-08-12 13:22:13 +02:00
tpm_ftpm_tee.h
…
tpm_i2c_atmel.c
…
tpm_i2c_infineon.c
…
tpm_i2c_nuvoton.c
…
tpm_ibmvtpm.c tpm: ibmvtpm: Avoid error message when process gets signal while waiting 2021-09-15 09:50:30 +02:00
tpm_ibmvtpm.h tpm: ibmvtpm: Avoid error message when process gets signal while waiting 2021-09-15 09:50:30 +02:00
tpm_infineon.c
…
tpm_nsc.c
…
tpm_ppi.c
…
tpm_tis.c tpm_tis: Disable interrupts on ThinkPad T490s 2020-11-06 18:21:00 +02:00
tpm_tis_core.c tpm: fix NPE on probe for missing device 2022-01-27 10:54:24 +01:00
tpm_tis_core.h tpm: fix Atmel TPM crash caused by too frequent queries 2021-11-18 14:04:11 +01:00
tpm_tis_spi.h
…
tpm_tis_spi_cr50.c
…
tpm_tis_spi_main.c tpm_tis_spi: Add missing SPI ID 2021-11-18 14:04:11 +01:00
tpm_tis_synquacer.c tpm: tis: add support for MMIO TPM on SynQuacer 2020-10-02 00:21:02 +03:00
tpm_vtpm_proxy.c
…
tpmrm-dev.c tpm: Unify the mismatching TPM space buffer sizes 2020-07-24 09:26:23 +03:00
xen-tpmfront.c
…