summaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2012-09-19 15:34:47 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-21 09:51:09 -0700
commit05fb79e45ee28b97a7cb74bd5ea3a88a8d13db1c (patch)
treeeec3011de3dd26155c1c0895b099e8ccd1926e2c /drivers/tty
parent43eca0aef73cc6f0d37ad139f1cbb810e62e409d (diff)
downloadlinux-05fb79e45ee28b97a7cb74bd5ea3a88a8d13db1c.tar.gz
linux-05fb79e45ee28b97a7cb74bd5ea3a88a8d13db1c.tar.bz2
linux-05fb79e45ee28b97a7cb74bd5ea3a88a8d13db1c.zip
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')
-rw-r--r--drivers/tty/pty.c2
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)
index = devpts_new_index(inode);
if (index < 0) {
retval = index;
+ mutex_unlock(&devpts_mutex);
goto err_file;
}
@@ -667,7 +668,6 @@ out:
mutex_unlock(&tty_mutex);
devpts_kill_index(inode, index);
err_file:
- mutex_unlock(&devpts_mutex);
tty_free_file(filp);
return retval;
}