Commit a4b05bb1 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Allow unimap change on non fg console

From: Kurt Garloff <garloff@suse.de>

The comment in front of vt_ioctl() reads
/*
 * We handle the console-specific ioctl's here.  We allow the
 * capability to modify any console, not just the fg_console.=20
 */

Unfortunately, this does not apply to PIO_UNIMAPCLR, nor
GIO_/PIO_UNIMAP. They always operate on the current foreground
console, which is inconsistent at least. For most ioctls, the
comment is applicable.

It also causes problems, as setfont can't do the full job on
the non-fg consoles. (OK, our setfont is slightly changed to
even try it ... as you know.)

The attached patch does fix this.

I have a similar patch for 2.4, but it never got merged :-(
because not many people seem to care and I submitted in the middle
of the 2.4 series ...
It has been in UnitedLinux/SUSE kernels for ages, though.
parent e86ff3c7
...@@ -332,7 +332,7 @@ do_fontx_ioctl(int cmd, struct consolefontdesc *user_cfd, int perm, struct conso ...@@ -332,7 +332,7 @@ do_fontx_ioctl(int cmd, struct consolefontdesc *user_cfd, int perm, struct conso
} }
static inline int static inline int
do_unimap_ioctl(int cmd, struct unimapdesc *user_ud,int perm) do_unimap_ioctl(int cmd, struct unimapdesc *user_ud, int perm, unsigned int console)
{ {
struct unimapdesc tmp; struct unimapdesc tmp;
int i = 0; int i = 0;
...@@ -348,9 +348,11 @@ do_unimap_ioctl(int cmd, struct unimapdesc *user_ud,int perm) ...@@ -348,9 +348,11 @@ do_unimap_ioctl(int cmd, struct unimapdesc *user_ud,int perm)
case PIO_UNIMAP: case PIO_UNIMAP:
if (!perm) if (!perm)
return -EPERM; return -EPERM;
return con_set_unimap(fg_console, tmp.entry_ct, tmp.entries); return con_set_unimap(console, tmp.entry_ct, tmp.entries);
case GIO_UNIMAP: case GIO_UNIMAP:
return con_get_unimap(fg_console, tmp.entry_ct, &(user_ud->entry_ct), tmp.entries); if (!perm && fg_console != console)
return -EPERM;
return con_get_unimap(console, tmp.entry_ct, &(user_ud->entry_ct), tmp.entries);
} }
return 0; return 0;
} }
...@@ -966,13 +968,13 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -966,13 +968,13 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
return -EPERM; return -EPERM;
i = copy_from_user(&ui, (void *)arg, sizeof(struct unimapinit)); i = copy_from_user(&ui, (void *)arg, sizeof(struct unimapinit));
if (i) return -EFAULT; if (i) return -EFAULT;
con_clear_unimap(fg_console, &ui); con_clear_unimap(console, &ui);
return 0; return 0;
} }
case PIO_UNIMAP: case PIO_UNIMAP:
case GIO_UNIMAP: case GIO_UNIMAP:
return do_unimap_ioctl(cmd, (struct unimapdesc *)arg, perm); return do_unimap_ioctl(cmd, (struct unimapdesc *)arg, perm, console);
case VT_LOCKSWITCH: case VT_LOCKSWITCH:
if (!capable(CAP_SYS_TTY_CONFIG)) if (!capable(CAP_SYS_TTY_CONFIG))
......
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