aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/proc/inode.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index effa6c0c467a..e6a818a93f3d 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -156,10 +156,13 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
156 156
157 WARN_ON(de && de->deleted); 157 WARN_ON(de && de->deleted);
158 158
159 if (de != NULL && !try_module_get(de->owner))
160 goto out_mod;
161
159 inode = iget(sb, ino); 162 inode = iget(sb, ino);
160 if (!inode) 163 if (!inode)
161 goto out_fail; 164 goto out_ino;
162 165
163 PROC_I(inode)->pde = de; 166 PROC_I(inode)->pde = de;
164 if (de) { 167 if (de) {
165 if (de->mode) { 168 if (de->mode) {
@@ -171,20 +174,20 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
171 inode->i_size = de->size; 174 inode->i_size = de->size;
172 if (de->nlink) 175 if (de->nlink)
173 inode->i_nlink = de->nlink; 176 inode->i_nlink = de->nlink;
174 if (!try_module_get(de->owner))
175 goto out_fail;
176 if (de->proc_iops) 177 if (de->proc_iops)
177 inode->i_op = de->proc_iops; 178 inode->i_op = de->proc_iops;
178 if (de->proc_fops) 179 if (de->proc_fops)
179 inode->i_fop = de->proc_fops; 180 inode->i_fop = de->proc_fops;
180 } 181 }
181 182
182out:
183 return inode; 183 return inode;
184 184
185out_fail: 185out_ino:
186 if (de != NULL)
187 module_put(de->owner);
188out_mod:
186 de_put(de); 189 de_put(de);
187 goto out; 190 return NULL;
188} 191}
189 192
190int proc_fill_super(struct super_block *s, void *data, int silent) 193int proc_fill_super(struct super_block *s, void *data, int silent)