aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/pty.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-07-11 02:40:40 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-12 17:27:08 -0400
commit79d753209245de3d6f02480535a8f5cf21ad02f7 (patch)
treec2aa38c82c6b067e7ca9ae7d40abbc81f51ce124 /drivers/tty/pty.c
parent157a4b311c45c9aba75a990464d9680867dc8805 (diff)
tty: double unlock on error in ptmx_open()
The problem here is that we called mutex_unlock(&devpts_mutex) on the error path when we weren't holding the lock. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r--drivers/tty/pty.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index d8558834ce57..a0ca0830cbcf 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -618,13 +618,12 @@ static int ptmx_open(struct inode *inode, struct file *filp)
618 /* find a device that is not in use. */ 618 /* find a device that is not in use. */
619 mutex_lock(&devpts_mutex); 619 mutex_lock(&devpts_mutex);
620 index = devpts_new_index(inode); 620 index = devpts_new_index(inode);
621 mutex_unlock(&devpts_mutex);
621 if (index < 0) { 622 if (index < 0) {
622 retval = index; 623 retval = index;
623 goto err_file; 624 goto err_file;
624 } 625 }
625 626
626 mutex_unlock(&devpts_mutex);
627
628 mutex_lock(&tty_mutex); 627 mutex_lock(&tty_mutex);
629 tty = tty_init_dev(ptm_driver, index); 628 tty = tty_init_dev(ptm_driver, index);
630 629
@@ -659,7 +658,6 @@ out:
659 mutex_unlock(&tty_mutex); 658 mutex_unlock(&tty_mutex);
660 devpts_kill_index(inode, index); 659 devpts_kill_index(inode, index);
661err_file: 660err_file:
662 mutex_unlock(&devpts_mutex);
663 tty_free_file(filp); 661 tty_free_file(filp);
664 return retval; 662 return retval;
665} 663}