diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/tpm/tpm.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 92676292bea..b85ee76e4b4 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -1055,6 +1055,7 @@ ssize_t tpm_read(struct file *file, char __user *buf, | |||
1055 | { | 1055 | { |
1056 | struct tpm_chip *chip = file->private_data; | 1056 | struct tpm_chip *chip = file->private_data; |
1057 | ssize_t ret_size; | 1057 | ssize_t ret_size; |
1058 | int rc; | ||
1058 | 1059 | ||
1059 | del_singleshot_timer_sync(&chip->user_read_timer); | 1060 | del_singleshot_timer_sync(&chip->user_read_timer); |
1060 | flush_work_sync(&chip->work); | 1061 | flush_work_sync(&chip->work); |
@@ -1065,8 +1066,11 @@ ssize_t tpm_read(struct file *file, char __user *buf, | |||
1065 | ret_size = size; | 1066 | ret_size = size; |
1066 | 1067 | ||
1067 | mutex_lock(&chip->buffer_mutex); | 1068 | mutex_lock(&chip->buffer_mutex); |
1068 | if (copy_to_user(buf, chip->data_buffer, ret_size)) | 1069 | rc = copy_to_user(buf, chip->data_buffer, ret_size); |
1070 | memset(chip->data_buffer, 0, ret_size); | ||
1071 | if (rc) | ||
1069 | ret_size = -EFAULT; | 1072 | ret_size = -EFAULT; |
1073 | |||
1070 | mutex_unlock(&chip->buffer_mutex); | 1074 | mutex_unlock(&chip->buffer_mutex); |
1071 | } | 1075 | } |
1072 | 1076 | ||