Commit 183c948a authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'tty-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty fixes from Greg KH:
 "Here are two tty fixes for issues found.

  One was due to a merge error in 4.6-rc1, and the other a regression
  fix for UML consoles that broke in 4.6-rc1.

  Both have been in linux-next for a while"

* tag 'tty-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  tty: Fix merge of "tty: Refactor tty_open()"
  tty: Fix UML console breakage
parents ffb927d1 5e00bbfb
...@@ -2049,14 +2049,13 @@ static struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode, ...@@ -2049,14 +2049,13 @@ static struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode,
if (tty) { if (tty) {
mutex_unlock(&tty_mutex); mutex_unlock(&tty_mutex);
retval = tty_lock_interruptible(tty); retval = tty_lock_interruptible(tty);
tty_kref_put(tty); /* drop kref from tty_driver_lookup_tty() */
if (retval) { if (retval) {
if (retval == -EINTR) if (retval == -EINTR)
retval = -ERESTARTSYS; retval = -ERESTARTSYS;
tty = ERR_PTR(retval); tty = ERR_PTR(retval);
goto out; goto out;
} }
/* safe to drop the kref from tty_driver_lookup_tty() */
tty_kref_put(tty);
retval = tty_reopen(tty); retval = tty_reopen(tty);
if (retval < 0) { if (retval < 0) {
tty_unlock(tty); tty_unlock(tty);
...@@ -2158,7 +2157,7 @@ static int tty_open(struct inode *inode, struct file *filp) ...@@ -2158,7 +2157,7 @@ static int tty_open(struct inode *inode, struct file *filp)
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
spin_lock_irq(&current->sighand->siglock); spin_lock_irq(&current->sighand->siglock);
noctty = (filp->f_flags & O_NOCTTY) || noctty = (filp->f_flags & O_NOCTTY) ||
device == MKDEV(TTY_MAJOR, 0) || (IS_ENABLED(CONFIG_VT) && device == MKDEV(TTY_MAJOR, 0)) ||
device == MKDEV(TTYAUX_MAJOR, 1) || device == MKDEV(TTYAUX_MAJOR, 1) ||
(tty->driver->type == TTY_DRIVER_TYPE_PTY && (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
tty->driver->subtype == PTY_TYPE_MASTER); tty->driver->subtype == PTY_TYPE_MASTER);
......
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