Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213483
b: refs/heads/master
c: f573bd1
h: refs/heads/master
i:
  213481: a77ed3d
  213479: d8b6ce7
v: v3
  • Loading branch information
Pekka Enberg authored and Greg Kroah-Hartman committed Oct 22, 2010
1 parent 9e5715b commit 65cce92
Show file tree
Hide file tree
Showing 4 changed files with 16 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: 8a28af7f7e42cd0f107e0d84e4ece89e7ef24d3f
refs/heads/master: f573bd1764f0f3f47754ca1ae7b2eb2909798a60
4 changes: 3 additions & 1 deletion trunk/drivers/char/pty.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,9 @@ static int ptmx_open(struct inode *inode, struct file *filp)

set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */

tty_add_file(tty, filp);
retval = tty_add_file(tty, filp);
if (retval)
goto out;

retval = devpts_pty_new(inode, tty->link);
if (retval)
Expand Down
15 changes: 11 additions & 4 deletions trunk/drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,13 @@ static inline struct tty_struct *file_tty(struct file *file)
}

/* Associate a new file with the tty structure */
void tty_add_file(struct tty_struct *tty, struct file *file)
int tty_add_file(struct tty_struct *tty, struct file *file)
{
struct tty_file_private *priv;

/* XXX: must implement proper error handling in callers */
priv = kmalloc(sizeof(*priv), GFP_KERNEL|__GFP_NOFAIL);
priv = kmalloc(sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;

priv->tty = tty;
priv->file = file;
Expand All @@ -210,6 +211,8 @@ void tty_add_file(struct tty_struct *tty, struct file *file)
spin_lock(&tty_files_lock);
list_add(&priv->list, &tty->tty_files);
spin_unlock(&tty_files_lock);

return 0;
}

/* Delete file from its tty */
Expand Down Expand Up @@ -1877,7 +1880,11 @@ static int tty_open(struct inode *inode, struct file *filp)
return PTR_ERR(tty);
}

tty_add_file(tty, filp);
retval = tty_add_file(tty, filp);
if (retval) {
tty_unlock();
return retval;
}

check_tty_count(tty, "tty_open");
if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/tty.h
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ extern void proc_clear_tty(struct task_struct *p);
extern struct tty_struct *get_current_tty(void);
extern void tty_default_fops(struct file_operations *fops);
extern struct tty_struct *alloc_tty_struct(void);
extern void tty_add_file(struct tty_struct *tty, struct file *file);
extern int tty_add_file(struct tty_struct *tty, struct file *file);
extern void free_tty_struct(struct tty_struct *tty);
extern void initialize_tty_struct(struct tty_struct *tty,
struct tty_driver *driver, int idx);
Expand Down

0 comments on commit 65cce92

Please sign in to comment.