From ad6d883f56bf4f15c9da93c25ba2d9edd4658d7f Mon Sep 17 00:00:00 2001 From: Sukadev Bhattiprolu Date: Tue, 17 Nov 2009 18:35:43 -0800 Subject: [PATCH] --- yaml --- r: 175331 b: refs/heads/master c: edfacdd6f81119b9005615593f2cbd94b8c7e2d8 h: refs/heads/master i: 175329: 8d6eb7794759718d49fa902859b9c484a4fdf583 175327: bbb20165e8852aaf8c549cb0b0f8e32cf8506548 v: v3 --- [refs] | 2 +- trunk/fs/devpts/inode.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 5e88c4ef5c26..3432eacf7918 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 68cb4f8e246bbbc649980be0628cae9265870a91 +refs/heads/master: edfacdd6f81119b9005615593f2cbd94b8c7e2d8 diff --git a/trunk/fs/devpts/inode.c b/trunk/fs/devpts/inode.c index d5f8c96964be..8882ecc0f1bf 100644 --- a/trunk/fs/devpts/inode.c +++ b/trunk/fs/devpts/inode.c @@ -517,11 +517,23 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty) struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number) { + struct dentry *dentry; + struct tty_struct *tty; + BUG_ON(pts_inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR)); + /* Ensure dentry has not been deleted by devpts_pty_kill() */ + dentry = d_find_alias(pts_inode); + if (!dentry) + return NULL; + + tty = NULL; if (pts_inode->i_sb->s_magic == DEVPTS_SUPER_MAGIC) - return (struct tty_struct *)pts_inode->i_private; - return NULL; + tty = (struct tty_struct *)pts_inode->i_private; + + dput(dentry); + + return tty; } void devpts_pty_kill(struct tty_struct *tty)