aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/vc_screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/vc_screen.c')
-rw-r--r--drivers/char/vc_screen.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
index 791930320a13..83aeedda200c 100644
--- a/drivers/char/vc_screen.c
+++ b/drivers/char/vc_screen.c
@@ -28,12 +28,13 @@
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/mm.h> 29#include <linux/mm.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/mutex.h>
31#include <linux/vt_kern.h> 32#include <linux/vt_kern.h>
32#include <linux/selection.h> 33#include <linux/selection.h>
33#include <linux/kbd_kern.h> 34#include <linux/kbd_kern.h>
34#include <linux/console.h> 35#include <linux/console.h>
35#include <linux/smp_lock.h>
36#include <linux/device.h> 36#include <linux/device.h>
37
37#include <asm/uaccess.h> 38#include <asm/uaccess.h>
38#include <asm/byteorder.h> 39#include <asm/byteorder.h>
39#include <asm/unaligned.h> 40#include <asm/unaligned.h>
@@ -70,11 +71,11 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig)
70{ 71{
71 int size; 72 int size;
72 73
73 down(&con_buf_sem); 74 mutex_lock(&con_buf_mtx);
74 size = vcs_size(file->f_path.dentry->d_inode); 75 size = vcs_size(file->f_path.dentry->d_inode);
75 switch (orig) { 76 switch (orig) {
76 default: 77 default:
77 up(&con_buf_sem); 78 mutex_unlock(&con_buf_mtx);
78 return -EINVAL; 79 return -EINVAL;
79 case 2: 80 case 2:
80 offset += size; 81 offset += size;
@@ -85,11 +86,11 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig)
85 break; 86 break;
86 } 87 }
87 if (offset < 0 || offset > size) { 88 if (offset < 0 || offset > size) {
88 up(&con_buf_sem); 89 mutex_unlock(&con_buf_mtx);
89 return -EINVAL; 90 return -EINVAL;
90 } 91 }
91 file->f_pos = offset; 92 file->f_pos = offset;
92 up(&con_buf_sem); 93 mutex_unlock(&con_buf_mtx);
93 return file->f_pos; 94 return file->f_pos;
94} 95}
95 96
@@ -106,7 +107,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
106 unsigned short *org = NULL; 107 unsigned short *org = NULL;
107 ssize_t ret; 108 ssize_t ret;
108 109
109 down(&con_buf_sem); 110 mutex_lock(&con_buf_mtx);
110 111
111 pos = *ppos; 112 pos = *ppos;
112 113
@@ -263,7 +264,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
263 ret = read; 264 ret = read;
264unlock_out: 265unlock_out:
265 release_console_sem(); 266 release_console_sem();
266 up(&con_buf_sem); 267 mutex_unlock(&con_buf_mtx);
267 return ret; 268 return ret;
268} 269}
269 270
@@ -280,7 +281,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
280 u16 *org0 = NULL, *org = NULL; 281 u16 *org0 = NULL, *org = NULL;
281 size_t ret; 282 size_t ret;
282 283
283 down(&con_buf_sem); 284 mutex_lock(&con_buf_mtx);
284 285
285 pos = *ppos; 286 pos = *ppos;
286 287
@@ -450,7 +451,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
450unlock_out: 451unlock_out:
451 release_console_sem(); 452 release_console_sem();
452 453
453 up(&con_buf_sem); 454 mutex_unlock(&con_buf_mtx);
454 455
455 return ret; 456 return ret;
456} 457}