aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/vt
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r--drivers/tty/vt/vc_screen.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
index a672ed192d33..3c27c4bc6040 100644
--- a/drivers/tty/vt/vc_screen.c
+++ b/drivers/tty/vt/vc_screen.c
@@ -159,7 +159,13 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig)
159 int size; 159 int size;
160 160
161 mutex_lock(&con_buf_mtx); 161 mutex_lock(&con_buf_mtx);
162 console_lock();
162 size = vcs_size(file->f_path.dentry->d_inode); 163 size = vcs_size(file->f_path.dentry->d_inode);
164 console_unlock();
165 if (size < 0) {
166 mutex_unlock(&con_buf_mtx);
167 return size;
168 }
163 switch (orig) { 169 switch (orig) {
164 default: 170 default:
165 mutex_unlock(&con_buf_mtx); 171 mutex_unlock(&con_buf_mtx);
@@ -237,6 +243,12 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
237 * could sleep. 243 * could sleep.
238 */ 244 */
239 size = vcs_size(inode); 245 size = vcs_size(inode);
246 if (size < 0) {
247 if (read)
248 break;
249 ret = size;
250 goto unlock_out;
251 }
240 if (pos >= size) 252 if (pos >= size)
241 break; 253 break;
242 if (count > size - pos) 254 if (count > size - pos)
@@ -436,6 +448,12 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
436 * Return data written up to now on failure. 448 * Return data written up to now on failure.
437 */ 449 */
438 size = vcs_size(inode); 450 size = vcs_size(inode);
451 if (size < 0) {
452 if (written)
453 break;
454 ret = size;
455 goto unlock_out;
456 }
439 if (pos >= size) 457 if (pos >= size)
440 break; 458 break;
441 if (this_round > size - pos) 459 if (this_round > size - pos)