diff options
author | Alan Cox <alan@linux.intel.com> | 2012-09-19 16:34:47 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-21 18:51:09 +0200 |
commit | 05fb79e45ee28b97a7cb74bd5ea3a88a8d13db1c (patch) | |
tree | eec3011de3dd26155c1c0895b099e8ccd1926e2c /drivers | |
parent | serial_core: Fix race in uart_handle_dcd_change (diff) | |
download | linux-05fb79e45ee28b97a7cb74bd5ea3a88a8d13db1c.tar.xz 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')
-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) 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; } |