Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280663
b: refs/heads/master
c: ba5db44
h: refs/heads/master
i:
  280661: 8222371
  280659: 381ad00
  280655: 931dbae
v: v3
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Nov 15, 2011
1 parent ebfe877 commit abe5fe2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5b5e70408f1e8a48deebedc26ba982bbc7db343e
refs/heads/master: ba5db44895ec3abc5317a9af86001e688a72185c
32 changes: 17 additions & 15 deletions trunk/drivers/tty/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1916,27 +1916,20 @@ static int tty_open(struct inode *inode, struct file *filp)

tty = tty_open_current_tty(device, filp);
if (IS_ERR(tty)) {
tty_unlock();
mutex_unlock(&tty_mutex);
tty_free_file(filp);
return PTR_ERR(tty);
retval = PTR_ERR(tty);
goto err_unlock;
} else if (!tty) {
driver = tty_lookup_driver(device, filp, &noctty, &index);
if (IS_ERR(driver)) {
tty_unlock();
mutex_unlock(&tty_mutex);
tty_free_file(filp);
return PTR_ERR(driver);
retval = PTR_ERR(driver);
goto err_unlock;
}

/* check whether we're reopening an existing tty */
tty = tty_driver_lookup_tty(driver, inode, index);
if (IS_ERR(tty)) {
tty_unlock();
mutex_unlock(&tty_mutex);
tty_driver_kref_put(driver);
tty_free_file(filp);
return PTR_ERR(tty);
retval = PTR_ERR(tty);
goto err_unlock;
}
}

Expand All @@ -1952,8 +1945,8 @@ static int tty_open(struct inode *inode, struct file *filp)
tty_driver_kref_put(driver);
if (IS_ERR(tty)) {
tty_unlock();
tty_free_file(filp);
return PTR_ERR(tty);
retval = PTR_ERR(tty);
goto err_file;
}

tty_add_file(tty, filp);
Expand Down Expand Up @@ -2013,6 +2006,15 @@ static int tty_open(struct inode *inode, struct file *filp)
tty_unlock();
mutex_unlock(&tty_mutex);
return 0;
err_unlock:
tty_unlock();
mutex_unlock(&tty_mutex);
/* after locks to avoid deadlock */
if (!IS_ERR_OR_NULL(driver))
tty_driver_kref_put(driver);
err_file:
tty_free_file(filp);
return retval;
}


Expand Down

0 comments on commit abe5fe2

Please sign in to comment.