aboutsummaryrefslogtreecommitdiffstats
path: root/fs/devpts/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/devpts/inode.c')
-rw-r--r--fs/devpts/inode.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 638db9b769ac..b292ed7ff1ca 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -27,6 +27,7 @@
27#define DEVPTS_SUPER_MAGIC 0x1cd1 27#define DEVPTS_SUPER_MAGIC 0x1cd1
28 28
29#define DEVPTS_DEFAULT_MODE 0600 29#define DEVPTS_DEFAULT_MODE 0600
30#define PTMX_MINOR 2
30 31
31extern int pty_limit; /* Config limit on Unix98 ptys */ 32extern int pty_limit; /* Config limit on Unix98 ptys */
32static DEFINE_IDA(allocated_ptys); 33static DEFINE_IDA(allocated_ptys);
@@ -247,19 +248,11 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
247 248
248struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number) 249struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
249{ 250{
250 struct dentry *dentry = get_node(number); 251 BUG_ON(pts_inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR));
251 struct tty_struct *tty;
252
253 tty = NULL;
254 if (!IS_ERR(dentry)) {
255 if (dentry->d_inode)
256 tty = dentry->d_inode->i_private;
257 dput(dentry);
258 }
259
260 mutex_unlock(&devpts_root->d_inode->i_mutex);
261 252
262 return tty; 253 if (pts_inode->i_sb->s_magic == DEVPTS_SUPER_MAGIC)
254 return (struct tty_struct *)pts_inode->i_private;
255 return NULL;
263} 256}
264 257
265void devpts_pty_kill(struct tty_struct *tty) 258void devpts_pty_kill(struct tty_struct *tty)