Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05fb79e4 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman
Browse files

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: default avatarFengguang Wu <fengguang.wu@intel.com>
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 43eca0ae
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -628,6 +628,7 @@ static int ptmx_open(struct inode *inode, struct file *filp)
	index = devpts_new_index(inode);
	index = devpts_new_index(inode);
	if (index < 0) {
	if (index < 0) {
		retval = index;
		retval = index;
		mutex_unlock(&devpts_mutex);
		goto err_file;
		goto err_file;
	}
	}


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