From: Greg Kroah-Hartman Date: Sun, 14 Feb 2016 22:36:04 +0000 (-0800) Subject: Merge 4.5-rc4 into tty-next X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=249f3c4fe4fdef159d3f9b3f7a6c41a92103c860;p=linux-beck.git Merge 4.5-rc4 into tty-next We want the fixes in here, and this resolves a merge error in tty_io.c Signed-off-by: Greg Kroah-Hartman --- 249f3c4fe4fdef159d3f9b3f7a6c41a92103c860 diff --cc drivers/tty/pty.c index 78170e7aa3a3,2348fa613707..e16a49b507ef --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@@ -660,10 -674,21 +660,17 @@@ static int pty_unix98_install(struct tt return pty_common_install(driver, tty, false); } -static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty) -{ -} - /* this is called once with whichever end is closed last */ -static void pty_unix98_shutdown(struct tty_struct *tty) +static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty) { - devpts_kill_index(tty->driver_data, tty->index); + struct inode *ptmx_inode; + + if (tty->driver->subtype == PTY_TYPE_MASTER) + ptmx_inode = tty->driver_data; + else + ptmx_inode = tty->link->driver_data; + devpts_kill_index(ptmx_inode, tty->index); + devpts_del_ref(ptmx_inode); } static const struct tty_operations ptm_unix98_ops = { diff --cc drivers/tty/tty_mutex.c index 75351e4b77df,dfa9ec03fa8e..d8bae67a6174 --- a/drivers/tty/tty_mutex.c +++ b/drivers/tty/tty_mutex.c @@@ -24,10 -26,13 +26,13 @@@ int tty_lock_interruptible(struct tty_s if (WARN(tty->magic != TTY_MAGIC, "L Bad %p\n", tty)) return -EIO; tty_kref_get(tty); - return mutex_lock_interruptible(&tty->legacy_mutex); + ret = mutex_lock_interruptible(&tty->legacy_mutex); + if (ret) + tty_kref_put(tty); + return ret; } -void __lockfunc tty_unlock(struct tty_struct *tty) +void tty_unlock(struct tty_struct *tty) { if (WARN(tty->magic != TTY_MAGIC, "U Bad %p\n", tty)) return;