aboutsummaryrefslogtreecommitdiffstats
path: root/fs/devpts/inode.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-21 13:06:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-21 13:06:51 -0400
commit10effcb548c170d59ea1d2152f2ee0ad45ce4c9d (patch)
tree6a1bf04ed66a1dcd242e8b2bd0c86690194cc09f /fs/devpts/inode.c
parentc3ca48f062a37c2f79560a9b0b9f1b08039aa248 (diff)
parent0f60f240d522772467c7d2cebedb910748c78ed4 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: FS: lookup_mnt() is only used in the core fs routines now bfs: fix bitmap size argument to find_first_zero_bit() fs: Use BUG_ON(!mnt) at dentry_open(). fs: devpts_pty_new() return -ENOMEM if dentry allocation failed nfs: lock() vs unlock() typo pstore: fix leaking ->i_private introduce sys_syncfs to sync a single file system Small typo fix... Filesystem: fifo: Fixed coding style issue. fs/inode: Fix kernel-doc format for inode_init_owner select: remove unused MAX_SELECT_SECONDS vfs: cleanup do_vfs_ioctl()
Diffstat (limited to 'fs/devpts/inode.c')
-rw-r--r--fs/devpts/inode.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 1bb547c9cad6..c6bd815dc794 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -479,6 +479,7 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
479 struct dentry *root = sb->s_root; 479 struct dentry *root = sb->s_root;
480 struct pts_fs_info *fsi = DEVPTS_SB(sb); 480 struct pts_fs_info *fsi = DEVPTS_SB(sb);
481 struct pts_mount_opts *opts = &fsi->mount_opts; 481 struct pts_mount_opts *opts = &fsi->mount_opts;
482 int ret = 0;
482 char s[12]; 483 char s[12];
483 484
484 /* We're supposed to be given the slave end of a pty */ 485 /* We're supposed to be given the slave end of a pty */
@@ -504,11 +505,14 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
504 if (!IS_ERR(dentry)) { 505 if (!IS_ERR(dentry)) {
505 d_add(dentry, inode); 506 d_add(dentry, inode);
506 fsnotify_create(root->d_inode, dentry); 507 fsnotify_create(root->d_inode, dentry);
508 } else {
509 iput(inode);
510 ret = -ENOMEM;
507 } 511 }
508 512
509 mutex_unlock(&root->d_inode->i_mutex); 513 mutex_unlock(&root->d_inode->i_mutex);
510 514
511 return 0; 515 return ret;
512} 516}
513 517
514struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number) 518struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
@@ -544,17 +548,12 @@ void devpts_pty_kill(struct tty_struct *tty)
544 mutex_lock(&root->d_inode->i_mutex); 548 mutex_lock(&root->d_inode->i_mutex);
545 549
546 dentry = d_find_alias(inode); 550 dentry = d_find_alias(inode);
547 if (IS_ERR(dentry))
548 goto out;
549
550 if (dentry) {
551 inode->i_nlink--;
552 d_delete(dentry);
553 dput(dentry); /* d_alloc_name() in devpts_pty_new() */
554 }
555 551
552 inode->i_nlink--;
553 d_delete(dentry);
554 dput(dentry); /* d_alloc_name() in devpts_pty_new() */
556 dput(dentry); /* d_find_alias above */ 555 dput(dentry); /* d_find_alias above */
557out: 556
558 mutex_unlock(&root->d_inode->i_mutex); 557 mutex_unlock(&root->d_inode->i_mutex);
559} 558}
560 559