mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 01:30:52 +07:00
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>
This commit is contained in:
parent
43eca0aef7
commit
05fb79e45e
@ -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 @@ 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user