tty: revert incorrectly applied lock patch
I sent GregKH this after the pre-requisites. He dropped the pre-requesites for good reason and unfortunately then applied this patch. Without this reverted you get random kernel memory corruption which will make bisecting anything between it and the properly applied patches a complete sod. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
467a3ca5ca
commit
6d31a88cb2
@@ -47,7 +47,6 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
|
||||
wake_up_interruptible(&tty->read_wait);
|
||||
wake_up_interruptible(&tty->write_wait);
|
||||
tty->packet = 0;
|
||||
/* Review - krefs on tty_link ?? */
|
||||
if (!tty->link)
|
||||
return;
|
||||
tty->link->packet = 0;
|
||||
@@ -63,9 +62,9 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
|
||||
mutex_unlock(&devpts_mutex);
|
||||
}
|
||||
#endif
|
||||
tty_unlock(tty);
|
||||
tty_unlock();
|
||||
tty_vhangup(tty->link);
|
||||
tty_lock(tty);
|
||||
tty_lock();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,26 +615,26 @@ static int ptmx_open(struct inode *inode, struct file *filp)
|
||||
return retval;
|
||||
|
||||
/* find a device that is not in use. */
|
||||
mutex_lock(&devpts_mutex);
|
||||
tty_lock();
|
||||
index = devpts_new_index(inode);
|
||||
mutex_unlock(&devpts_mutex);
|
||||
tty_unlock();
|
||||
if (index < 0) {
|
||||
retval = index;
|
||||
goto err_file;
|
||||
}
|
||||
|
||||
mutex_lock(&tty_mutex);
|
||||
mutex_lock(&devpts_mutex);
|
||||
tty = tty_init_dev(ptm_driver, index);
|
||||
mutex_unlock(&devpts_mutex);
|
||||
tty_lock();
|
||||
mutex_unlock(&tty_mutex);
|
||||
|
||||
if (IS_ERR(tty)) {
|
||||
retval = PTR_ERR(tty);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* The tty returned here is locked so we can safely
|
||||
drop the mutex */
|
||||
mutex_unlock(&tty_mutex);
|
||||
|
||||
set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */
|
||||
|
||||
tty_add_file(tty, filp);
|
||||
@@ -648,15 +647,15 @@ static int ptmx_open(struct inode *inode, struct file *filp)
|
||||
if (retval)
|
||||
goto err_release;
|
||||
|
||||
tty_unlock(tty);
|
||||
tty_unlock();
|
||||
return 0;
|
||||
err_release:
|
||||
tty_unlock(tty);
|
||||
tty_unlock();
|
||||
tty_release(inode, filp);
|
||||
return retval;
|
||||
out:
|
||||
mutex_unlock(&tty_mutex);
|
||||
devpts_kill_index(inode, index);
|
||||
tty_unlock();
|
||||
err_file:
|
||||
tty_free_file(filp);
|
||||
return retval;
|
||||
|
Reference in New Issue
Block a user