tpm: ibmvtpm: don't call tpm_ibmvtpm_resume() under rtce_lock
Subsystems (4)
PATCH 1/1 tpm: ibmvtpm: don't call tpm_ibmvtpm_resume() under rtce_lock
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()")
Signed-off-by Hyunjung Ko <[email protected]>
--- drivers/char/tpm/tpm_ibmvtpm.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/char/tpm/tpm_ibmvtpm.c +7 -0
@@ -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; }
Signature · 1 line
2.43.0