Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83450
b: refs/heads/master
c: a6752f3
h: refs/heads/master
v: v3
  • Loading branch information
Daniel Walker authored and Linus Torvalds committed Feb 6, 2008
1 parent 4559534 commit af92be9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 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: 4749380ed688884a3bd3328b1bf32529d96aa49b
refs/heads/master: a6752f3f538e9dc0d0e7fdb2080532554a5eb395
20 changes: 10 additions & 10 deletions trunk/drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ EXPORT_SYMBOL(tty_mutex);
extern struct tty_driver *ptm_driver; /* Unix98 pty masters; for /dev/ptmx */
extern int pty_limit; /* Config limit on Unix98 ptys */
static DEFINE_IDR(allocated_ptys);
static DECLARE_MUTEX(allocated_ptys_lock);
static DEFINE_MUTEX(allocated_ptys_lock);
static int ptmx_open(struct inode *, struct file *);
#endif

Expand Down Expand Up @@ -2571,9 +2571,9 @@ static void release_dev(struct file * filp)
#ifdef CONFIG_UNIX98_PTYS
/* Make this pty number available for reallocation */
if (devpts) {
down(&allocated_ptys_lock);
mutex_lock(&allocated_ptys_lock);
idr_remove(&allocated_ptys, idx);
up(&allocated_ptys_lock);
mutex_unlock(&allocated_ptys_lock);
}
#endif

Expand Down Expand Up @@ -2737,24 +2737,24 @@ static int ptmx_open(struct inode * inode, struct file * filp)
nonseekable_open(inode, filp);

/* find a device that is not in use. */
down(&allocated_ptys_lock);
mutex_lock(&allocated_ptys_lock);
if (!idr_pre_get(&allocated_ptys, GFP_KERNEL)) {
up(&allocated_ptys_lock);
mutex_unlock(&allocated_ptys_lock);
return -ENOMEM;
}
idr_ret = idr_get_new(&allocated_ptys, NULL, &index);
if (idr_ret < 0) {
up(&allocated_ptys_lock);
mutex_unlock(&allocated_ptys_lock);
if (idr_ret == -EAGAIN)
return -ENOMEM;
return -EIO;
}
if (index >= pty_limit) {
idr_remove(&allocated_ptys, index);
up(&allocated_ptys_lock);
mutex_unlock(&allocated_ptys_lock);
return -EIO;
}
up(&allocated_ptys_lock);
mutex_unlock(&allocated_ptys_lock);

mutex_lock(&tty_mutex);
retval = init_dev(ptm_driver, index, &tty);
Expand All @@ -2781,9 +2781,9 @@ static int ptmx_open(struct inode * inode, struct file * filp)
release_dev(filp);
return retval;
out:
down(&allocated_ptys_lock);
mutex_lock(&allocated_ptys_lock);
idr_remove(&allocated_ptys, index);
up(&allocated_ptys_lock);
mutex_unlock(&allocated_ptys_lock);
return retval;
}
#endif
Expand Down

0 comments on commit af92be9

Please sign in to comment.