]> git.ipfire.org Git - thirdparty/linux.git/commit
tpm: tpm_tis_spi: Use wait_woken() in wait_for_tmp_stat()
authorJarkko Sakkinen <jarkko@kernel.org>
Sat, 9 May 2026 18:51:07 +0000 (21:51 +0300)
committerJarkko Sakkinen <jarkko@kernel.org>
Sun, 21 Jun 2026 01:25:28 +0000 (04:25 +0300)
commitc0c9cfb3b75def8bf200a2d4db09015806acfeaf
tree36b0a724cfa600b03ac6c0d6f7df8f69a31ae39d
parent595ca21f797e43da24cb80529fb8b29381ed8716
tpm: tpm_tis_spi: Use wait_woken() in wait_for_tmp_stat()

wait_event_interruptible_timeout() evaluates its condition after setting
the current task state to TASK_INTERRUPTIBLE.

With CONFIG_DEBUG_ATOMIC_SLEEP this triggers a warning when the IRQ wait
path is used:

    tpm_tis_status()
      tpm_tis_spi_read_bytes()
        tpm_tis_spi_transfer_full()
          spi_bus_lock()
            mutex_lock()

Address this with the following measures:

1. Call wait_tpm_stat_cond() only while tasking is running.
2. Use wait_woken() to wait for changes.

Cc: stable@vger.kernel.org # v4.19+
Cc: Linus Walleij <linusw@kernel.org>
Reported-by: Stefan Wahren <wahrenst@gmx.net>
Closes: https://lore.kernel.org/linux-integrity/6964bec7-3dbb-453b-89ef-9b990217a8b9@gmx.net/
Fixes: 1a339b658d9d ("tpm_tis_spi: Pass the SPI IRQ down to the driver")
Reviewed-by: Linus Walleij <linusw@kernel.org>
Tested-by: Stefan Wahren <wahrenst@gmx.net>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
drivers/char/tpm/tpm_tis_core.c