Skip to content

Commit fa2825d

Browse files
jgunthorpeJarkko Sakkinen
authored andcommitted
tpm: Begin the process to deprecate user_read_timer
For a long time the cdev read/write interface had this strange idea that userspace had to read the result within 60 seconds otherwise it is discarded. Perhaps this made sense under some older locking regime, but in the modern kernel it is not required and is just dangerous. Since something may be relying on this, double the timeout and print a warning. We can remove the code in a few years, but this should be enough to prevent new users. Suggested-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
1 parent 1d19155 commit fa2825d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/char/tpm/tpm-dev.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ static void user_reader_timeout(unsigned long ptr)
3838
{
3939
struct file_priv *priv = (struct file_priv *)ptr;
4040

41+
pr_warn("TPM user space timeout is deprecated (pid=%d)\n",
42+
task_tgid_nr(current));
43+
4144
schedule_work(&priv->work);
4245
}
4346

@@ -157,7 +160,7 @@ static ssize_t tpm_write(struct file *file, const char __user *buf,
157160
mutex_unlock(&priv->buffer_mutex);
158161

159162
/* Set a timeout by which the reader must come claim the result */
160-
mod_timer(&priv->user_read_timer, jiffies + (60 * HZ));
163+
mod_timer(&priv->user_read_timer, jiffies + (120 * HZ));
161164

162165
return in_size;
163166
}

0 commit comments

Comments
 (0)