aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDaniel Drake <dsd@gentoo.org>2005-12-02 20:56:21 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2005-12-14 15:42:55 -0800
commit6ca4c553e663b1eebe5630e70fd7cb39c4b910e3 (patch)
tree0d9ffeba509231d28a1c3ed93da5a6007f2bb12d /drivers
parentbb4828a25fd619bc7c9eae63f7c71dfe93f930b9 (diff)
[PATCH] 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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/vt_ioctl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index 1d44f69e1fd..24011e7c81f 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -80,6 +80,9 @@ do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm, struct kbd_str
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 __user *user_kdgkb, int perm)
int i, j, k;
int ret;
+ if (!capable(CAP_SYS_TTY_CONFIG))
+ perm = 0;
+
kbs = kmalloc(sizeof(*kbs), GFP_KERNEL);
if (!kbs) {
ret = -ENOMEM;