Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alan Cox and committed by
Greg Kroah-Hartman
05fb79e4 43eca0ae

+1 -1
+1 -1
drivers/tty/pty.c
··· 628 628 index = devpts_new_index(inode); 629 629 if (index < 0) { 630 630 retval = index; 631 + mutex_unlock(&devpts_mutex); 631 632 goto err_file; 632 633 } 633 634 ··· 668 667 mutex_unlock(&tty_mutex); 669 668 devpts_kill_index(inode, index); 670 669 err_file: 671 - mutex_unlock(&devpts_mutex); 672 670 tty_free_file(filp); 673 671 return retval; 674 672 }