* [patch] tty: double unlock on error in ptmx_open()
@ 2012-07-11 6:40 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2012-07-11 6:40 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, Alan Cox, kernel-janitors
The problem here is that we called mutex_unlock(&devpts_mutex) on the
error path when we weren't holding the lock.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index d855883..a0ca083 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -618,13 +618,12 @@ static int ptmx_open(struct inode *inode, struct file *filp)
/* find a device that is not in use. */
mutex_lock(&devpts_mutex);
index = devpts_new_index(inode);
+ mutex_unlock(&devpts_mutex);
if (index < 0) {
retval = index;
goto err_file;
}
- mutex_unlock(&devpts_mutex);
-
mutex_lock(&tty_mutex);
tty = tty_init_dev(ptm_driver, index);
@@ -659,7 +658,6 @@ out:
mutex_unlock(&tty_mutex);
devpts_kill_index(inode, index);
err_file:
- mutex_unlock(&devpts_mutex);
tty_free_file(filp);
return retval;
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2012-07-11 6:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-11 6:40 [patch] tty: double unlock on error in ptmx_open() Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox