Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit edab558f authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman
Browse files

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: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dbca36ea
Loading
Loading
Loading
Loading
+13 −10
Original line number Original line Diff line number Diff line
@@ -3969,9 +3969,6 @@ static int con_font_get(struct vc_data *vc, struct console_font_op *op)
	int rc = -EINVAL;
	int rc = -EINVAL;
	int c;
	int c;


	if (vc->vc_mode != KD_TEXT)
		return -EINVAL;

	if (op->data) {
	if (op->data) {
		font.data = kmalloc(max_font_size, GFP_KERNEL);
		font.data = kmalloc(max_font_size, GFP_KERNEL);
		if (!font.data)
		if (!font.data)
@@ -3980,7 +3977,9 @@ static int con_font_get(struct vc_data *vc, struct console_font_op *op)
		font.data = NULL;
		font.data = NULL;


	console_lock();
	console_lock();
	if (vc->vc_sw->con_font_get)
	if (vc->vc_mode != KD_TEXT)
		rc = -EINVAL;
	else if (vc->vc_sw->con_font_get)
		rc = vc->vc_sw->con_font_get(vc, &font);
		rc = vc->vc_sw->con_font_get(vc, &font);
	else
	else
		rc = -ENOSYS;
		rc = -ENOSYS;
@@ -4062,7 +4061,9 @@ static int con_font_set(struct vc_data *vc, struct console_font_op *op)
	if (IS_ERR(font.data))
	if (IS_ERR(font.data))
		return PTR_ERR(font.data);
		return PTR_ERR(font.data);
	console_lock();
	console_lock();
	if (vc->vc_sw->con_font_set)
	if (vc->vc_mode != KD_TEXT)
		rc = -EINVAL;
	else if (vc->vc_sw->con_font_set)
		rc = vc->vc_sw->con_font_set(vc, &font, op->flags);
		rc = vc->vc_sw->con_font_set(vc, &font, op->flags);
	else
	else
		rc = -ENOSYS;
		rc = -ENOSYS;
@@ -4078,8 +4079,6 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op)
	char *s = name;
	char *s = name;
	int rc;
	int rc;


	if (vc->vc_mode != KD_TEXT)
		return -EINVAL;


	if (!op->data)
	if (!op->data)
		s = NULL;
		s = NULL;
@@ -4089,6 +4088,10 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op)
		name[MAX_FONT_NAME - 1] = 0;
		name[MAX_FONT_NAME - 1] = 0;


	console_lock();
	console_lock();
	if (vc->vc_mode != KD_TEXT) {
		console_unlock();
		return -EINVAL;
	}
	if (vc->vc_sw->con_font_default)
	if (vc->vc_sw->con_font_default)
		rc = vc->vc_sw->con_font_default(vc, &font, s);
		rc = vc->vc_sw->con_font_default(vc, &font, s);
	else
	else
@@ -4106,11 +4109,11 @@ static int con_font_copy(struct vc_data *vc, struct console_font_op *op)
	int con = op->height;
	int con = op->height;
	int rc;
	int rc;


	if (vc->vc_mode != KD_TEXT)
		return -EINVAL;


	console_lock();
	console_lock();
	if (!vc->vc_sw->con_font_copy)
	if (vc->vc_mode != KD_TEXT)
		rc = -EINVAL;
	else if (!vc->vc_sw->con_font_copy)
		rc = -ENOSYS;
		rc = -ENOSYS;
	else if (con < 0 || !vc_cons_allocated(con))
	else if (con < 0 || !vc_cons_allocated(con))
		rc = -ENOTTY;
		rc = -ENOTTY;