blob: a7617c65f7a036e3a5b13ac4e9ea1fedb8d1f890 [file] [log] [blame]
From stable-bounces@linux.kernel.org Fri Dec 2 13:00:25 2005
Message-ID: <4390B4F5.5000907@gentoo.org>
Date: Fri, 02 Dec 2005 20:56:21 +0000
From: Daniel Drake <dsd@gentoo.org>
To: stable@kernel.org
Cc: marcelo.tosatti@cyclades.com, mikpe@csd.uu.se
Subject: setkeys needs root
This patch combines commit 0b360adbdb54d5b98b78d57ba0916bc4b8871968 (make
setkeys root-only) and commit e3f17f0f6e98f58edb13cb38810d93e6d4808e68 (only
disallow setting by users)
Because people can play games reprogramming keys and leaving traps for the
next user of the console.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/char/vt_ioctl.c | 6 ++++++
1 file changed, 6 insertions(+)
--- linux-2.6.14.3.orig/drivers/char/vt_ioctl.c
+++ linux-2.6.14.3/drivers/char/vt_ioctl.c
@@ -80,6 +80,9 @@ do_kdsk_ioctl(int cmd, struct kbentry __
if (copy_from_user(&tmp, user_kbe, sizeof(struct kbentry)))
return -EFAULT;
+ if (!capable(CAP_SYS_TTY_CONFIG))
+ perm = 0;
+
switch (cmd) {
case KDGKBENT:
key_map = key_maps[s];
@@ -192,6 +195,9 @@ do_kdgkb_ioctl(int cmd, struct kbsentry
int i, j, k;
int ret;
+ if (!capable(CAP_SYS_TTY_CONFIG))
+ perm = 0;
+
kbs = kmalloc(sizeof(*kbs), GFP_KERNEL);
if (!kbs) {
ret = -ENOMEM;