[PATCH] tpm: Revert "tpm: fix invalid locking in NONBLOCKING mode"
From: Mario Limonciello
Date: Tue May 26 2020 - 14:32:41 EST
This reverts commit d23d12484307b40eea549b8a858f5fffad913897.
This commit has caused regressions for the XPS 9560 containing
a Nuvoton TPM.
As mentioned by the reporter all TPM2 commands are failing with:
ERROR:tcti:src/tss2-tcti/tcti-device.c:290:tcti_device_receive()
Failed to read response from fd 3, got errno 1: Operation not permitted
The reporter bisected this issue back to this commit which was
backported to stable as commit 4d6ebc4.
Cc: Jeffrin Jose T <jeffrin@xxxxxxxxxxxxxxxxxxx>
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206275
Fixes: d23d124 ("tpm: fix invalid locking in NONBLOCKING mode")
Reported-by: Alex Guzman <alex@xxxxxxxxx>
Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxxx>
---
drivers/char/tpm/tpm-dev-common.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/drivers/char/tpm/tpm-dev-common.c b/drivers/char/tpm/tpm-dev-common.c
index 87f449340202..bc9d7c7ddc01 100644
--- a/drivers/char/tpm/tpm-dev-common.c
+++ b/drivers/char/tpm/tpm-dev-common.c
@@ -61,12 +61,6 @@ static void tpm_dev_async_work(struct work_struct *work)
mutex_lock(&priv->buffer_mutex);
priv->command_enqueued = false;
- ret = tpm_try_get_ops(priv->chip);
- if (ret) {
- priv->response_length = ret;
- goto out;
- }
-
ret = tpm_dev_transmit(priv->chip, priv->space, priv->data_buffer,
sizeof(priv->data_buffer));
tpm_put_ops(priv->chip);
@@ -74,7 +68,6 @@ static void tpm_dev_async_work(struct work_struct *work)
priv->response_length = ret;
mod_timer(&priv->user_read_timer, jiffies + (120 * HZ));
}
-out:
mutex_unlock(&priv->buffer_mutex);
wake_up_interruptible(&priv->async_wait);
}
@@ -211,7 +204,6 @@ ssize_t tpm_common_write(struct file *file, const char __user *buf,
if (file->f_flags & O_NONBLOCK) {
priv->command_enqueued = true;
queue_work(tpm_dev_wq, &priv->async_work);
- tpm_put_ops(priv->chip);
mutex_unlock(&priv->buffer_mutex);
return size;
}
--
2.25.1