[PATCH] tpm: ibmvtpm: don't call tpm_ibmvtpm_resume() under rtce_lock

From: Hyunjung Ko

Date: Wed Nov 18 2026 - 06:24:39 EST


tpm_ibmvtpm_send() holds rtce_lock (a spinlock) and, when the hypervisor
call returns H_CLOSED after a Live Partition Migration, calls
tpm_ibmvtpm_resume() to re-enable the CRQ before retrying.
tpm_ibmvtpm_resume() sleeps (msleep()), so calling it under the spinlock
sleeps in atomic context.

The in-flight command is already serialized by tpm_processing_cmd (other
senders wait on ibmvtpm->wq), so the rtce buffer stays valid without the
lock. Drop rtce_lock around the resume and retry.

Fixes: eba5cf3dcb84 ("tpm: ibmvtpm: retry on H_CLOSED in tpm_ibmvtpm_send()")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Hyunjung Ko <hj351016@xxxxxxxxx>
---
drivers/char/tpm/tpm_ibmvtpm.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
index 51c7e2add3d2..e06c4db2e138 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -247,7 +247,14 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t bufsiz,
* ibmvtpm_send_crq() once before failing.
*/
if (rc == H_CLOSED && retry) {
+ /*
+ * tpm_ibmvtpm_resume() re-enables the CRQ and sleeps,
+ * so it must not run under rtce_lock. The in-flight
+ * command is already protected by tpm_processing_cmd.
+ */
+ spin_unlock(&ibmvtpm->rtce_lock);
tpm_ibmvtpm_resume(ibmvtpm->dev);
+ spin_lock(&ibmvtpm->rtce_lock);
retry = false;
goto again;
}
--
2.43.0