aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-11 18:34:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-11 18:34:40 -0500
commit0f4974c439dd7826c85bae4e6a8088ce2db0f498 (patch)
treefdabc7d9bb7d7bc49aad547c0aac3a633ce01f09 /fs
parent3126c136bc30225d7a43af741778aa50e95e467a (diff)
parent36ba782e9674cdc29ec7003757df0b375e99fa96 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (58 commits) tty: split the lock up a bit further tty: Move the leader test in disassociate tty: Push the bkl down a bit in the hangup code tty: Push the lock down further into the ldisc code tty: push the BKL down into the handlers a bit tty: moxa: split open lock tty: moxa: Kill the use of lock_kernel tty: moxa: Fix modem op locking tty: moxa: Kill off the throttle method tty: moxa: Locking clean up tty: moxa: rework the locking a bit tty: moxa: Use more tty_port ops tty: isicom: fix deadlock on shutdown tty: mxser: Use the new locking rules to fix setserial properly tty: mxser: use the tty_port_open method tty: isicom: sort out the board init logic tty: isicom: switch to the new tty_port_open helper tty: tty_port: Add a kref object to the tty port tty: istallion: tty port open/close methods tty: stallion: Convert to the tty_port_open/close methods ...
Diffstat (limited to 'fs')
-rw-r--r--fs/devpts/inode.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index d5f8c96964be..8882ecc0f1bf 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -517,11 +517,23 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
517 517
518struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number) 518struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
519{ 519{
520 struct dentry *dentry;
521 struct tty_struct *tty;
522
520 BUG_ON(pts_inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR)); 523 BUG_ON(pts_inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR));
521 524
525 /* Ensure dentry has not been deleted by devpts_pty_kill() */
526 dentry = d_find_alias(pts_inode);
527 if (!dentry)
528 return NULL;
529
530 tty = NULL;
522 if (pts_inode->i_sb->s_magic == DEVPTS_SUPER_MAGIC) 531 if (pts_inode->i_sb->s_magic == DEVPTS_SUPER_MAGIC)
523 return (struct tty_struct *)pts_inode->i_private; 532 tty = (struct tty_struct *)pts_inode->i_private;
524 return NULL; 533
534 dput(dentry);
535
536 return tty;
525} 537}
526 538
527void devpts_pty_kill(struct tty_struct *tty) 539void devpts_pty_kill(struct tty_struct *tty)