diff options
Diffstat (limited to 'drivers/tty/tty_io.c')
-rw-r--r-- | drivers/tty/tty_io.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 0065da4b11c..936a4ead6c2 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -90,7 +90,6 @@ | |||
90 | #include <linux/proc_fs.h> | 90 | #include <linux/proc_fs.h> |
91 | #include <linux/init.h> | 91 | #include <linux/init.h> |
92 | #include <linux/module.h> | 92 | #include <linux/module.h> |
93 | #include <linux/smp_lock.h> | ||
94 | #include <linux/device.h> | 93 | #include <linux/device.h> |
95 | #include <linux/wait.h> | 94 | #include <linux/wait.h> |
96 | #include <linux/bitops.h> | 95 | #include <linux/bitops.h> |
@@ -2465,12 +2464,12 @@ out: | |||
2465 | * Locking: none (up to the driver) | 2464 | * Locking: none (up to the driver) |
2466 | */ | 2465 | */ |
2467 | 2466 | ||
2468 | static int tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p) | 2467 | static int tty_tiocmget(struct tty_struct *tty, int __user *p) |
2469 | { | 2468 | { |
2470 | int retval = -EINVAL; | 2469 | int retval = -EINVAL; |
2471 | 2470 | ||
2472 | if (tty->ops->tiocmget) { | 2471 | if (tty->ops->tiocmget) { |
2473 | retval = tty->ops->tiocmget(tty, file); | 2472 | retval = tty->ops->tiocmget(tty); |
2474 | 2473 | ||
2475 | if (retval >= 0) | 2474 | if (retval >= 0) |
2476 | retval = put_user(retval, p); | 2475 | retval = put_user(retval, p); |
@@ -2481,7 +2480,6 @@ static int tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p | |||
2481 | /** | 2480 | /** |
2482 | * tty_tiocmset - set modem status | 2481 | * tty_tiocmset - set modem status |
2483 | * @tty: tty device | 2482 | * @tty: tty device |
2484 | * @file: user file pointer | ||
2485 | * @cmd: command - clear bits, set bits or set all | 2483 | * @cmd: command - clear bits, set bits or set all |
2486 | * @p: pointer to desired bits | 2484 | * @p: pointer to desired bits |
2487 | * | 2485 | * |
@@ -2491,7 +2489,7 @@ static int tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p | |||
2491 | * Locking: none (up to the driver) | 2489 | * Locking: none (up to the driver) |
2492 | */ | 2490 | */ |
2493 | 2491 | ||
2494 | static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd, | 2492 | static int tty_tiocmset(struct tty_struct *tty, unsigned int cmd, |
2495 | unsigned __user *p) | 2493 | unsigned __user *p) |
2496 | { | 2494 | { |
2497 | int retval; | 2495 | int retval; |
@@ -2518,7 +2516,7 @@ static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int | |||
2518 | } | 2516 | } |
2519 | set &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; | 2517 | set &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; |
2520 | clear &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; | 2518 | clear &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; |
2521 | return tty->ops->tiocmset(tty, file, set, clear); | 2519 | return tty->ops->tiocmset(tty, set, clear); |
2522 | } | 2520 | } |
2523 | 2521 | ||
2524 | static int tty_tiocgicount(struct tty_struct *tty, void __user *arg) | 2522 | static int tty_tiocgicount(struct tty_struct *tty, void __user *arg) |
@@ -2627,6 +2625,11 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
2627 | return put_user(tty->ldisc->ops->num, (int __user *)p); | 2625 | return put_user(tty->ldisc->ops->num, (int __user *)p); |
2628 | case TIOCSETD: | 2626 | case TIOCSETD: |
2629 | return tiocsetd(tty, p); | 2627 | return tiocsetd(tty, p); |
2628 | case TIOCVHANGUP: | ||
2629 | if (!capable(CAP_SYS_ADMIN)) | ||
2630 | return -EPERM; | ||
2631 | tty_vhangup(tty); | ||
2632 | return 0; | ||
2630 | case TIOCGDEV: | 2633 | case TIOCGDEV: |
2631 | { | 2634 | { |
2632 | unsigned int ret = new_encode_dev(tty_devnum(real_tty)); | 2635 | unsigned int ret = new_encode_dev(tty_devnum(real_tty)); |
@@ -2655,11 +2658,11 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
2655 | return send_break(tty, arg ? arg*100 : 250); | 2658 | return send_break(tty, arg ? arg*100 : 250); |
2656 | 2659 | ||
2657 | case TIOCMGET: | 2660 | case TIOCMGET: |
2658 | return tty_tiocmget(tty, file, p); | 2661 | return tty_tiocmget(tty, p); |
2659 | case TIOCMSET: | 2662 | case TIOCMSET: |
2660 | case TIOCMBIC: | 2663 | case TIOCMBIC: |
2661 | case TIOCMBIS: | 2664 | case TIOCMBIS: |
2662 | return tty_tiocmset(tty, file, cmd, p); | 2665 | return tty_tiocmset(tty, cmd, p); |
2663 | case TIOCGICOUNT: | 2666 | case TIOCGICOUNT: |
2664 | retval = tty_tiocgicount(tty, p); | 2667 | retval = tty_tiocgicount(tty, p); |
2665 | /* For the moment allow fall through to the old method */ | 2668 | /* For the moment allow fall through to the old method */ |
@@ -2677,7 +2680,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
2677 | break; | 2680 | break; |
2678 | } | 2681 | } |
2679 | if (tty->ops->ioctl) { | 2682 | if (tty->ops->ioctl) { |
2680 | retval = (tty->ops->ioctl)(tty, file, cmd, arg); | 2683 | retval = (tty->ops->ioctl)(tty, cmd, arg); |
2681 | if (retval != -ENOIOCTLCMD) | 2684 | if (retval != -ENOIOCTLCMD) |
2682 | return retval; | 2685 | return retval; |
2683 | } | 2686 | } |
@@ -2705,7 +2708,7 @@ static long tty_compat_ioctl(struct file *file, unsigned int cmd, | |||
2705 | return -EINVAL; | 2708 | return -EINVAL; |
2706 | 2709 | ||
2707 | if (tty->ops->compat_ioctl) { | 2710 | if (tty->ops->compat_ioctl) { |
2708 | retval = (tty->ops->compat_ioctl)(tty, file, cmd, arg); | 2711 | retval = (tty->ops->compat_ioctl)(tty, cmd, arg); |
2709 | if (retval != -ENOIOCTLCMD) | 2712 | if (retval != -ENOIOCTLCMD) |
2710 | return retval; | 2713 | return retval; |
2711 | } | 2714 | } |