diff options
Diffstat (limited to 'fs/proc/namespaces.c')
-rw-r--r-- | fs/proc/namespaces.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c index ad1adce6541d..dd2b35f78b09 100644 --- a/fs/proc/namespaces.c +++ b/fs/proc/namespaces.c | |||
@@ -87,16 +87,16 @@ static const struct inode_operations proc_ns_link_inode_operations = { | |||
87 | .setattr = proc_setattr, | 87 | .setattr = proc_setattr, |
88 | }; | 88 | }; |
89 | 89 | ||
90 | static int proc_ns_instantiate(struct inode *dir, | 90 | static struct dentry *proc_ns_instantiate(struct dentry *dentry, |
91 | struct dentry *dentry, struct task_struct *task, const void *ptr) | 91 | struct task_struct *task, const void *ptr) |
92 | { | 92 | { |
93 | const struct proc_ns_operations *ns_ops = ptr; | 93 | const struct proc_ns_operations *ns_ops = ptr; |
94 | struct inode *inode; | 94 | struct inode *inode; |
95 | struct proc_inode *ei; | 95 | struct proc_inode *ei; |
96 | 96 | ||
97 | inode = proc_pid_make_inode(dir->i_sb, task, S_IFLNK | S_IRWXUGO); | 97 | inode = proc_pid_make_inode(dentry->d_sb, task, S_IFLNK | S_IRWXUGO); |
98 | if (!inode) | 98 | if (!inode) |
99 | return -ENOENT; | 99 | return ERR_PTR(-ENOENT); |
100 | 100 | ||
101 | ei = PROC_I(inode); | 101 | ei = PROC_I(inode); |
102 | inode->i_op = &proc_ns_link_inode_operations; | 102 | inode->i_op = &proc_ns_link_inode_operations; |
@@ -104,8 +104,7 @@ static int proc_ns_instantiate(struct inode *dir, | |||
104 | pid_update_inode(task, inode); | 104 | pid_update_inode(task, inode); |
105 | 105 | ||
106 | d_set_d_op(dentry, &pid_dentry_operations); | 106 | d_set_d_op(dentry, &pid_dentry_operations); |
107 | d_add(dentry, inode); | 107 | return d_splice_alias(inode, dentry); |
108 | return 0; | ||
109 | } | 108 | } |
110 | 109 | ||
111 | static int proc_ns_dir_readdir(struct file *file, struct dir_context *ctx) | 110 | static int proc_ns_dir_readdir(struct file *file, struct dir_context *ctx) |
@@ -144,12 +143,10 @@ const struct file_operations proc_ns_dir_operations = { | |||
144 | static struct dentry *proc_ns_dir_lookup(struct inode *dir, | 143 | static struct dentry *proc_ns_dir_lookup(struct inode *dir, |
145 | struct dentry *dentry, unsigned int flags) | 144 | struct dentry *dentry, unsigned int flags) |
146 | { | 145 | { |
147 | int error; | ||
148 | struct task_struct *task = get_proc_task(dir); | 146 | struct task_struct *task = get_proc_task(dir); |
149 | const struct proc_ns_operations **entry, **last; | 147 | const struct proc_ns_operations **entry, **last; |
150 | unsigned int len = dentry->d_name.len; | 148 | unsigned int len = dentry->d_name.len; |
151 | 149 | struct dentry *res = ERR_PTR(-ENOENT); | |
152 | error = -ENOENT; | ||
153 | 150 | ||
154 | if (!task) | 151 | if (!task) |
155 | goto out_no_task; | 152 | goto out_no_task; |
@@ -164,11 +161,11 @@ static struct dentry *proc_ns_dir_lookup(struct inode *dir, | |||
164 | if (entry == last) | 161 | if (entry == last) |
165 | goto out; | 162 | goto out; |
166 | 163 | ||
167 | error = proc_ns_instantiate(dir, dentry, task, *entry); | 164 | res = proc_ns_instantiate(dentry, task, *entry); |
168 | out: | 165 | out: |
169 | put_task_struct(task); | 166 | put_task_struct(task); |
170 | out_no_task: | 167 | out_no_task: |
171 | return ERR_PTR(error); | 168 | return res; |
172 | } | 169 | } |
173 | 170 | ||
174 | const struct inode_operations proc_ns_dir_inode_operations = { | 171 | const struct inode_operations proc_ns_dir_inode_operations = { |