Commit 1e86b5bf authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman

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: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2812d9e9
...@@ -2571,7 +2571,6 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t ...@@ -2571,7 +2571,6 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t
struct pid *pgrp; struct pid *pgrp;
pid_t pgrp_nr; pid_t pgrp_nr;
int retval = tty_check_change(real_tty); int retval = tty_check_change(real_tty);
unsigned long flags;
if (retval == -EIO) if (retval == -EIO)
return -ENOTTY; return -ENOTTY;
...@@ -2594,10 +2593,10 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t ...@@ -2594,10 +2593,10 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t
if (session_of_pgrp(pgrp) != task_session(current)) if (session_of_pgrp(pgrp) != task_session(current))
goto out_unlock; goto out_unlock;
retval = 0; retval = 0;
spin_lock_irqsave(&tty->ctrl_lock, flags); spin_lock_irq(&tty->ctrl_lock);
put_pid(real_tty->pgrp); put_pid(real_tty->pgrp);
real_tty->pgrp = get_pid(pgrp); real_tty->pgrp = get_pid(pgrp);
spin_unlock_irqrestore(&tty->ctrl_lock, flags); spin_unlock_irq(&tty->ctrl_lock);
out_unlock: out_unlock:
rcu_read_unlock(); rcu_read_unlock();
return retval; return retval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment