diff options
author | Alan Cox <alan@linux.intel.com> | 2012-03-02 09:59:08 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-03-08 14:10:27 -0500 |
commit | edab558feba1e2826ae8d65506168d7ccea7aad9 (patch) | |
tree | a964e46c12f83517af0d7b756f00005bb66f26f8 /drivers/tty/vt/vt.c | |
parent | dbca36eab48ee48dfc60b8f41ffad54160ebdd09 (diff) |
vt: sort out locking for font handling
The font methods are console_lock covered. Unfortunately they don't extend
the lock over all the needed tests.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt/vt.c')
-rw-r--r-- | drivers/tty/vt/vt.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index ecdcc8a8f0ca..ce2b82343620 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -3969,9 +3969,6 @@ static int con_font_get(struct vc_data *vc, struct console_font_op *op) | |||
3969 | int rc = -EINVAL; | 3969 | int rc = -EINVAL; |
3970 | int c; | 3970 | int c; |
3971 | 3971 | ||
3972 | if (vc->vc_mode != KD_TEXT) | ||
3973 | return -EINVAL; | ||
3974 | |||
3975 | if (op->data) { | 3972 | if (op->data) { |
3976 | font.data = kmalloc(max_font_size, GFP_KERNEL); | 3973 | font.data = kmalloc(max_font_size, GFP_KERNEL); |
3977 | if (!font.data) | 3974 | if (!font.data) |
@@ -3980,7 +3977,9 @@ static int con_font_get(struct vc_data *vc, struct console_font_op *op) | |||
3980 | font.data = NULL; | 3977 | font.data = NULL; |
3981 | 3978 | ||
3982 | console_lock(); | 3979 | console_lock(); |
3983 | if (vc->vc_sw->con_font_get) | 3980 | if (vc->vc_mode != KD_TEXT) |
3981 | rc = -EINVAL; | ||
3982 | else if (vc->vc_sw->con_font_get) | ||
3984 | rc = vc->vc_sw->con_font_get(vc, &font); | 3983 | rc = vc->vc_sw->con_font_get(vc, &font); |
3985 | else | 3984 | else |
3986 | rc = -ENOSYS; | 3985 | rc = -ENOSYS; |
@@ -4062,7 +4061,9 @@ static int con_font_set(struct vc_data *vc, struct console_font_op *op) | |||
4062 | if (IS_ERR(font.data)) | 4061 | if (IS_ERR(font.data)) |
4063 | return PTR_ERR(font.data); | 4062 | return PTR_ERR(font.data); |
4064 | console_lock(); | 4063 | console_lock(); |
4065 | if (vc->vc_sw->con_font_set) | 4064 | if (vc->vc_mode != KD_TEXT) |
4065 | rc = -EINVAL; | ||
4066 | else if (vc->vc_sw->con_font_set) | ||
4066 | rc = vc->vc_sw->con_font_set(vc, &font, op->flags); | 4067 | rc = vc->vc_sw->con_font_set(vc, &font, op->flags); |
4067 | else | 4068 | else |
4068 | rc = -ENOSYS; | 4069 | rc = -ENOSYS; |
@@ -4078,8 +4079,6 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op) | |||
4078 | char *s = name; | 4079 | char *s = name; |
4079 | int rc; | 4080 | int rc; |
4080 | 4081 | ||
4081 | if (vc->vc_mode != KD_TEXT) | ||
4082 | return -EINVAL; | ||
4083 | 4082 | ||
4084 | if (!op->data) | 4083 | if (!op->data) |
4085 | s = NULL; | 4084 | s = NULL; |
@@ -4089,6 +4088,10 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op) | |||
4089 | name[MAX_FONT_NAME - 1] = 0; | 4088 | name[MAX_FONT_NAME - 1] = 0; |
4090 | 4089 | ||
4091 | console_lock(); | 4090 | console_lock(); |
4091 | if (vc->vc_mode != KD_TEXT) { | ||
4092 | console_unlock(); | ||
4093 | return -EINVAL; | ||
4094 | } | ||
4092 | if (vc->vc_sw->con_font_default) | 4095 | if (vc->vc_sw->con_font_default) |
4093 | rc = vc->vc_sw->con_font_default(vc, &font, s); | 4096 | rc = vc->vc_sw->con_font_default(vc, &font, s); |
4094 | else | 4097 | else |
@@ -4106,11 +4109,11 @@ static int con_font_copy(struct vc_data *vc, struct console_font_op *op) | |||
4106 | int con = op->height; | 4109 | int con = op->height; |
4107 | int rc; | 4110 | int rc; |
4108 | 4111 | ||
4109 | if (vc->vc_mode != KD_TEXT) | ||
4110 | return -EINVAL; | ||
4111 | 4112 | ||
4112 | console_lock(); | 4113 | console_lock(); |
4113 | if (!vc->vc_sw->con_font_copy) | 4114 | if (vc->vc_mode != KD_TEXT) |
4115 | rc = -EINVAL; | ||
4116 | else if (!vc->vc_sw->con_font_copy) | ||
4114 | rc = -ENOSYS; | 4117 | rc = -ENOSYS; |
4115 | else if (con < 0 || !vc_cons_allocated(con)) | 4118 | else if (con < 0 || !vc_cons_allocated(con)) |
4116 | rc = -ENOTTY; | 4119 | rc = -ENOTTY; |