diff options
Diffstat (limited to 'drivers/char/tpm/tpm-dev-common.c')
-rw-r--r-- | drivers/char/tpm/tpm-dev-common.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm-dev-common.c b/drivers/char/tpm/tpm-dev-common.c index 610638a80383..461bf0b8a094 100644 --- a/drivers/char/tpm/tpm-dev-common.c +++ b/drivers/char/tpm/tpm-dev-common.c | |||
@@ -110,6 +110,12 @@ ssize_t tpm_common_write(struct file *file, const char __user *buf, | |||
110 | return -EFAULT; | 110 | return -EFAULT; |
111 | } | 111 | } |
112 | 112 | ||
113 | if (in_size < 6 || | ||
114 | in_size < be32_to_cpu(*((__be32 *) (priv->data_buffer + 2)))) { | ||
115 | mutex_unlock(&priv->buffer_mutex); | ||
116 | return -EINVAL; | ||
117 | } | ||
118 | |||
113 | /* atomic tpm command send and result receive. We only hold the ops | 119 | /* atomic tpm command send and result receive. We only hold the ops |
114 | * lock during this period so that the tpm can be unregistered even if | 120 | * lock during this period so that the tpm can be unregistered even if |
115 | * the char dev is held open. | 121 | * the char dev is held open. |