diff options
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/generic.c | 2 | ||||
-rw-r--r-- | fs/proc/inode.c | 12 |
2 files changed, 6 insertions, 8 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 775fb21294d8..22a08ff3475d 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -398,6 +398,7 @@ struct dentry *proc_lookup(struct inode * dir, struct dentry *dentry, struct nam | |||
398 | if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { | 398 | if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { |
399 | unsigned int ino = de->low_ino; | 399 | unsigned int ino = de->low_ino; |
400 | 400 | ||
401 | de_get(de); | ||
401 | spin_unlock(&proc_subdir_lock); | 402 | spin_unlock(&proc_subdir_lock); |
402 | error = -EINVAL; | 403 | error = -EINVAL; |
403 | inode = proc_get_inode(dir->i_sb, ino, de); | 404 | inode = proc_get_inode(dir->i_sb, ino, de); |
@@ -414,6 +415,7 @@ struct dentry *proc_lookup(struct inode * dir, struct dentry *dentry, struct nam | |||
414 | d_add(dentry, inode); | 415 | d_add(dentry, inode); |
415 | return NULL; | 416 | return NULL; |
416 | } | 417 | } |
418 | de_put(de); | ||
417 | return ERR_PTR(error); | 419 | return ERR_PTR(error); |
418 | } | 420 | } |
419 | 421 | ||
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 22b1158389ae..d1de6378930c 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include "internal.h" | 22 | #include "internal.h" |
23 | 23 | ||
24 | static inline struct proc_dir_entry * de_get(struct proc_dir_entry *de) | 24 | struct proc_dir_entry *de_get(struct proc_dir_entry *de) |
25 | { | 25 | { |
26 | if (de) | 26 | if (de) |
27 | atomic_inc(&de->count); | 27 | atomic_inc(&de->count); |
@@ -31,7 +31,7 @@ static inline struct proc_dir_entry * de_get(struct proc_dir_entry *de) | |||
31 | /* | 31 | /* |
32 | * Decrements the use count and checks for deferred deletion. | 32 | * Decrements the use count and checks for deferred deletion. |
33 | */ | 33 | */ |
34 | static void de_put(struct proc_dir_entry *de) | 34 | void de_put(struct proc_dir_entry *de) |
35 | { | 35 | { |
36 | if (de) { | 36 | if (de) { |
37 | lock_kernel(); | 37 | lock_kernel(); |
@@ -146,11 +146,6 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino, | |||
146 | { | 146 | { |
147 | struct inode * inode; | 147 | struct inode * inode; |
148 | 148 | ||
149 | /* | ||
150 | * Increment the use count so the dir entry can't disappear. | ||
151 | */ | ||
152 | de_get(de); | ||
153 | |||
154 | WARN_ON(de && de->deleted); | 149 | WARN_ON(de && de->deleted); |
155 | 150 | ||
156 | if (de != NULL && !try_module_get(de->owner)) | 151 | if (de != NULL && !try_module_get(de->owner)) |
@@ -184,7 +179,6 @@ out_ino: | |||
184 | if (de != NULL) | 179 | if (de != NULL) |
185 | module_put(de->owner); | 180 | module_put(de->owner); |
186 | out_mod: | 181 | out_mod: |
187 | de_put(de); | ||
188 | return NULL; | 182 | return NULL; |
189 | } | 183 | } |
190 | 184 | ||
@@ -199,6 +193,7 @@ int proc_fill_super(struct super_block *s, void *data, int silent) | |||
199 | s->s_op = &proc_sops; | 193 | s->s_op = &proc_sops; |
200 | s->s_time_gran = 1; | 194 | s->s_time_gran = 1; |
201 | 195 | ||
196 | de_get(&proc_root); | ||
202 | root_inode = proc_get_inode(s, PROC_ROOT_INO, &proc_root); | 197 | root_inode = proc_get_inode(s, PROC_ROOT_INO, &proc_root); |
203 | if (!root_inode) | 198 | if (!root_inode) |
204 | goto out_no_root; | 199 | goto out_no_root; |
@@ -212,6 +207,7 @@ int proc_fill_super(struct super_block *s, void *data, int silent) | |||
212 | out_no_root: | 207 | out_no_root: |
213 | printk("proc_read_super: get root inode failed\n"); | 208 | printk("proc_read_super: get root inode failed\n"); |
214 | iput(root_inode); | 209 | iput(root_inode); |
210 | de_put(&proc_root); | ||
215 | return -ENOMEM; | 211 | return -ENOMEM; |
216 | } | 212 | } |
217 | MODULE_LICENSE("GPL"); | 213 | MODULE_LICENSE("GPL"); |