In this case nobody can open a slave point, so will be better return
from devpts_pty_new()
Now we should not check error code from d_find_alias() in
devpts_pty_kill(), because the dentry exists all times.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
struct dentry *root = sb->s_root;
struct pts_fs_info *fsi = DEVPTS_SB(sb);
struct pts_mount_opts *opts = &fsi->mount_opts;
struct dentry *root = sb->s_root;
struct pts_fs_info *fsi = DEVPTS_SB(sb);
struct pts_mount_opts *opts = &fsi->mount_opts;
char s[12];
/* We're supposed to be given the slave end of a pty */
char s[12];
/* We're supposed to be given the slave end of a pty */
if (!IS_ERR(dentry)) {
d_add(dentry, inode);
fsnotify_create(root->d_inode, dentry);
if (!IS_ERR(dentry)) {
d_add(dentry, inode);
fsnotify_create(root->d_inode, dentry);
+ } else {
+ iput(inode);
+ ret = -ENOMEM;
}
mutex_unlock(&root->d_inode->i_mutex);
}
mutex_unlock(&root->d_inode->i_mutex);
}
struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
}
struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
mutex_lock(&root->d_inode->i_mutex);
dentry = d_find_alias(inode);
mutex_lock(&root->d_inode->i_mutex);
dentry = d_find_alias(inode);
- if (IS_ERR(dentry))
- goto out;
-
- if (dentry) {
- inode->i_nlink--;
- d_delete(dentry);
- dput(dentry); /* d_alloc_name() in devpts_pty_new() */
- }
+ inode->i_nlink--;
+ d_delete(dentry);
+ dput(dentry); /* d_alloc_name() in devpts_pty_new() */
dput(dentry); /* d_find_alias above */
dput(dentry); /* d_find_alias above */
mutex_unlock(&root->d_inode->i_mutex);
}
mutex_unlock(&root->d_inode->i_mutex);
}