diff options
author | Alan Cox <alan@linux.intel.com> | 2012-09-19 10:34:47 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-21 12:51:09 -0400 |
commit | 05fb79e45ee28b97a7cb74bd5ea3a88a8d13db1c (patch) | |
tree | eec3011de3dd26155c1c0895b099e8ccd1926e2c /drivers/tty/pty.c | |
parent | 43eca0aef73cc6f0d37ad139f1cbb810e62e409d (diff) |
pty: Fix locking bug on error path
We end up dropping the mutex twice on some errors. We don't want to do
that.
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r-- | drivers/tty/pty.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 2bace847eb39..a82b39939a9c 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c | |||
@@ -628,6 +628,7 @@ static int ptmx_open(struct inode *inode, struct file *filp) | |||
628 | index = devpts_new_index(inode); | 628 | index = devpts_new_index(inode); |
629 | if (index < 0) { | 629 | if (index < 0) { |
630 | retval = index; | 630 | retval = index; |
631 | mutex_unlock(&devpts_mutex); | ||
631 | goto err_file; | 632 | goto err_file; |
632 | } | 633 | } |
633 | 634 | ||
@@ -667,7 +668,6 @@ out: | |||
667 | mutex_unlock(&tty_mutex); | 668 | mutex_unlock(&tty_mutex); |
668 | devpts_kill_index(inode, index); | 669 | devpts_kill_index(inode, index); |
669 | err_file: | 670 | err_file: |
670 | mutex_unlock(&devpts_mutex); | ||
671 | tty_free_file(filp); | 671 | tty_free_file(filp); |
672 | return retval; | 672 | return retval; |
673 | } | 673 | } |