Commit 5e190739 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] con_font_copy sanitized

->con_font_copy() sanitized.  We extract the number of console to copy the
font from in the caller (it's taken from the field of console_font_op that
is normally used for font height - messy even for an ioctl, but that animal
used to be passed all the way down into console drivers).

With decoding done in con_font_copy(), we simply pass source console number
into the method.
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent bd048df6
...@@ -3170,16 +3170,23 @@ int con_font_default(int currcons, struct console_font_op *op) ...@@ -3170,16 +3170,23 @@ int con_font_default(int currcons, struct console_font_op *op)
int con_font_copy(int currcons, struct console_font_op *op) int con_font_copy(int currcons, struct console_font_op *op)
{ {
int con = op->height;
struct vc_data *vc;
int rc; int rc;
if (vt_cons[currcons]->vc_mode != KD_TEXT) if (vt_cons[currcons]->vc_mode != KD_TEXT)
return -EINVAL; return -EINVAL;
acquire_console_sem(); acquire_console_sem();
if (sw->con_font_copy) vc = vc_cons[currcons].d;
rc = sw->con_font_copy(vc_cons[currcons].d, op); if (!sw->con_font_copy)
else
rc = -ENOSYS; rc = -ENOSYS;
else if (con < 0 || !vc_cons_allocated(con))
rc = -ENOTTY;
else if (con == vc->vc_num) /* nothing to do */
rc = 0;
else
rc = sw->con_font_copy(vc, con);
release_console_sem(); release_console_sem();
return rc; return rc;
} }
......
...@@ -2167,21 +2167,17 @@ static int fbcon_do_set_font(struct vc_data *vc, struct console_font_op *op, ...@@ -2167,21 +2167,17 @@ static int fbcon_do_set_font(struct vc_data *vc, struct console_font_op *op,
return 0; return 0;
} }
static int fbcon_copy_font(struct vc_data *vc, struct console_font_op *op) static int fbcon_copy_font(struct vc_data *vc, int con)
{ {
struct display *od; struct display *od = &fb_display[con];
int h = op->height; struct console_font_op crap;
if (h < 0 || !vc_cons_allocated(h))
return -ENOTTY;
if (h == vc->vc_num)
return 0; /* nothing to do */
od = &fb_display[h];
if (od->fontdata == vc->vc_font.data) if (od->fontdata == vc->vc_font.data)
return 0; /* already the same font... */ return 0; /* already the same font... */
op->width = vc->vc_font.width; crap.op = KD_FONT_OP_COPY;
op->height = vc->vc_font.height; crap.width = vc->vc_font.width;
return fbcon_do_set_font(vc, op, od->fontdata, od->userfont); crap.height = vc->vc_font.height;
return fbcon_do_set_font(vc, &crap, od->fontdata, od->userfont);
} }
static int fbcon_set_font(struct vc_data *vc, struct console_font_op *op) static int fbcon_set_font(struct vc_data *vc, struct console_font_op *op)
......
...@@ -44,7 +44,7 @@ struct consw { ...@@ -44,7 +44,7 @@ struct consw {
int (*con_font_set)(struct vc_data *, struct console_font_op *); int (*con_font_set)(struct vc_data *, struct console_font_op *);
int (*con_font_get)(struct vc_data *, struct console_font_op *); int (*con_font_get)(struct vc_data *, struct console_font_op *);
int (*con_font_default)(struct vc_data *, struct console_font *, char *); int (*con_font_default)(struct vc_data *, struct console_font *, char *);
int (*con_font_copy)(struct vc_data *, struct console_font_op *); int (*con_font_copy)(struct vc_data *, int);
int (*con_resize)(struct vc_data *, unsigned int, unsigned int); int (*con_resize)(struct vc_data *, unsigned int, unsigned int);
int (*con_set_palette)(struct vc_data *, unsigned char *); int (*con_set_palette)(struct vc_data *, unsigned char *);
int (*con_scrolldelta)(struct vc_data *, int); int (*con_scrolldelta)(struct vc_data *, int);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment