Skip to content

Commit

Permalink
pty: Fix locking bug on error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alan Cox authored and Greg Kroah-Hartman committed Sep 21, 2012
1 parent 43eca0a commit 05fb79e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/tty/pty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -667,7 +668,6 @@ static int ptmx_open(struct inode *inode, struct file *filp)
mutex_unlock(&tty_mutex);
devpts_kill_index(inode, index);
err_file:
mutex_unlock(&devpts_mutex);
tty_free_file(filp);
return retval;
}
Expand Down

0 comments on commit 05fb79e

Please sign in to comment.