Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 113454
b: refs/heads/master
c: 15582d3
h: refs/heads/master
v: v3
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Oct 13, 2008
1 parent 81aa09a commit 8dd66dc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 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: dbda4c0b97b18fd59b3964548361b4f92357f730
refs/heads/master: 15582d36a15978355d2168eaa018a3736db7281f
18 changes: 12 additions & 6 deletions trunk/drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,8 @@ static void tty_line_name(struct tty_driver *driver, int index, char *p)
* init_dev - initialise a tty device
* @driver: tty driver we are opening a device on
* @idx: device index
* @tty: returned tty structure
* @ret_tty: returned tty structure
* @first_ok: ok to open a new device (used by ptmx)
*
* Prepare a tty device. This may not be a "new" clean device but
* could also be an active device. The pty drivers require special
Expand All @@ -1248,7 +1249,7 @@ static void tty_line_name(struct tty_driver *driver, int index, char *p)
*/

static int init_dev(struct tty_driver *driver, int idx,
struct tty_struct **ret_tty)
struct tty_struct **ret_tty, int first_ok)
{
struct tty_struct *tty, *o_tty;
struct ktermios *tp, **tp_loc, *o_tp, **o_tp_loc;
Expand Down Expand Up @@ -1279,6 +1280,11 @@ static int init_dev(struct tty_driver *driver, int idx,
}
if (tty) goto fast_track;

if (driver->subtype == PTY_TYPE_MASTER &&
(driver->flags & TTY_DRIVER_DEVPTS_MEM) && !first_ok) {
retval = -EIO;
goto end_init;
}
/*
* First time open is complex, especially for PTY devices.
* This code guarantees that either everything succeeds and the
Expand Down Expand Up @@ -1413,7 +1419,7 @@ static int init_dev(struct tty_driver *driver, int idx,

if (retval)
goto release_mem_out;
goto success;
goto success;

/*
* This fast open can be used if the tty is already open.
Expand Down Expand Up @@ -1795,7 +1801,7 @@ static void release_dev(struct file *filp)
}

/**
* tty_open - open a tty device
* __tty_open - open a tty device
* @inode: inode of device file
* @filp: file pointer to tty
*
Expand Down Expand Up @@ -1874,7 +1880,7 @@ static int __tty_open(struct inode *inode, struct file *filp)
return -ENODEV;
}
got_driver:
retval = init_dev(driver, index, &tty);
retval = init_dev(driver, index, &tty, 0);
mutex_unlock(&tty_mutex);
if (retval)
return retval;
Expand Down Expand Up @@ -1971,7 +1977,7 @@ static int __ptmx_open(struct inode *inode, struct file *filp)
return index;

mutex_lock(&tty_mutex);
retval = init_dev(ptm_driver, index, &tty);
retval = init_dev(ptm_driver, index, &tty, 1);
mutex_unlock(&tty_mutex);

if (retval)
Expand Down

0 comments on commit 8dd66dc

Please sign in to comment.