Merge master.kernel.org:/home/rmk/linux-2.6-drvmodel
[linux-2.6-block.git] / drivers / char / vt_ioctl.c
index 5d386f4bea49fe94148f2eb2254216eadf7c6fc3..003dda147cd093a226d52a485d7b98d64186874d 100644 (file)
@@ -24,6 +24,8 @@
 #include <linux/major.h>
 #include <linux/fs.h>
 #include <linux/console.h>
+#include <linux/signal.h>
+#include <linux/timex.h>
 
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -190,6 +192,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))
+               return -EPERM;
+
        kbs = kmalloc(sizeof(*kbs), GFP_KERNEL);
        if (!kbs) {
                ret = -ENOMEM;
@@ -385,7 +390,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
                if (!perm)
                        return -EPERM;
                if (arg)
-                       arg = 1193182 / arg;
+                       arg = CLOCK_TICK_RATE / arg;
                kd_mksound(arg, 0);
                return 0;
 
@@ -402,7 +407,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
                ticks = HZ * ((arg >> 16) & 0xffff) / 1000;
                count = ticks ? (arg & 0xffff) : 0;
                if (count)
-                       count = 1193182 / count;
+                       count = CLOCK_TICK_RATE / count;
                kd_mksound(count, ticks);
                return 0;
        }
@@ -641,7 +646,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
                extern int spawnpid, spawnsig;
                if (!perm || !capable(CAP_KILL))
                  return -EPERM;
-               if (arg < 1 || arg > _NSIG || arg == SIGKILL)
+               if (!valid_signal(arg) || arg < 1 || arg == SIGKILL)
                  return -EINVAL;
                spawnpid = current->pid;
                spawnsig = arg;