diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2015-10-10 20:28:43 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-18 00:30:49 -0400 |
commit | 1e86b5bf15e2be662df303b7067ac08247713401 (patch) | |
tree | 8577fee20d9cf63a6275737a73b0c03efa026c37 | |
parent | 2812d9e9fd94c54b0482215f579e6aa04452a322 (diff) |
tty: core: Use correct spinlock flavor in tiocspgrp()
tiocspgrp() is the ioctl handler for TIOCSPGRP, which runs in
non-atomic context; use spin_lock/unlock_irq (since interrupt state
is on).
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/tty_io.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index aa48367a0c79..071671a8674f 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -2571,7 +2571,6 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t | |||
2571 | struct pid *pgrp; | 2571 | struct pid *pgrp; |
2572 | pid_t pgrp_nr; | 2572 | pid_t pgrp_nr; |
2573 | int retval = tty_check_change(real_tty); | 2573 | int retval = tty_check_change(real_tty); |
2574 | unsigned long flags; | ||
2575 | 2574 | ||
2576 | if (retval == -EIO) | 2575 | if (retval == -EIO) |
2577 | return -ENOTTY; | 2576 | return -ENOTTY; |
@@ -2594,10 +2593,10 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t | |||
2594 | if (session_of_pgrp(pgrp) != task_session(current)) | 2593 | if (session_of_pgrp(pgrp) != task_session(current)) |
2595 | goto out_unlock; | 2594 | goto out_unlock; |
2596 | retval = 0; | 2595 | retval = 0; |
2597 | spin_lock_irqsave(&tty->ctrl_lock, flags); | 2596 | spin_lock_irq(&tty->ctrl_lock); |
2598 | put_pid(real_tty->pgrp); | 2597 | put_pid(real_tty->pgrp); |
2599 | real_tty->pgrp = get_pid(pgrp); | 2598 | real_tty->pgrp = get_pid(pgrp); |
2600 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); | 2599 | spin_unlock_irq(&tty->ctrl_lock); |
2601 | out_unlock: | 2600 | out_unlock: |
2602 | rcu_read_unlock(); | 2601 | rcu_read_unlock(); |
2603 | return retval; | 2602 | return retval; |