提交 0eae4686 编写于 作者: G Greg Kroah-Hartman

Revert "tty: pty: Fix race condition between release_one_tty and pty_write"

This reverts commit b9ca5f85 as 0-day
shows it has a circular locking dependency.

Fixes: b9ca5f85 ("tty: pty: Fix race condition between release_one_tty and pty_write")
Reported-by: Nkernel test robot <lkp@intel.com>
Cc: Sahara <keun-o.park@darkmatter.ae>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 4b0a2c5f
...@@ -116,12 +116,6 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) ...@@ -116,12 +116,6 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)
if (tty->stopped) if (tty->stopped)
return 0; return 0;
mutex_lock(&tty_mutex);
if (to->magic != TTY_MAGIC) {
mutex_unlock(&tty_mutex);
return -EIO;
}
if (c > 0) { if (c > 0) {
spin_lock_irqsave(&to->port->lock, flags); spin_lock_irqsave(&to->port->lock, flags);
/* Stuff the data into the input queue of the other end */ /* Stuff the data into the input queue of the other end */
...@@ -131,7 +125,6 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) ...@@ -131,7 +125,6 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)
tty_flip_buffer_push(to->port); tty_flip_buffer_push(to->port);
spin_unlock_irqrestore(&to->port->lock, flags); spin_unlock_irqrestore(&to->port->lock, flags);
} }
mutex_unlock(&tty_mutex);
return c; return c;
} }
......
...@@ -1448,13 +1448,10 @@ static void release_one_tty(struct work_struct *work) ...@@ -1448,13 +1448,10 @@ static void release_one_tty(struct work_struct *work)
struct tty_driver *driver = tty->driver; struct tty_driver *driver = tty->driver;
struct module *owner = driver->owner; struct module *owner = driver->owner;
mutex_lock(&tty_mutex);
if (tty->ops->cleanup) if (tty->ops->cleanup)
tty->ops->cleanup(tty); tty->ops->cleanup(tty);
tty->magic = 0; tty->magic = 0;
mutex_unlock(&tty_mutex);
tty_driver_kref_put(driver); tty_driver_kref_put(driver);
module_put(owner); module_put(owner);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册