aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/generic.c')
-rw-r--r--fs/proc/generic.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 775fb21294d8..8a40e15f5ecb 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
@@ -476,14 +478,21 @@ int proc_readdir(struct file * filp,
476 } 478 }
477 479
478 do { 480 do {
481 struct proc_dir_entry *next;
482
479 /* filldir passes info to user space */ 483 /* filldir passes info to user space */
484 de_get(de);
480 spin_unlock(&proc_subdir_lock); 485 spin_unlock(&proc_subdir_lock);
481 if (filldir(dirent, de->name, de->namelen, filp->f_pos, 486 if (filldir(dirent, de->name, de->namelen, filp->f_pos,
482 de->low_ino, de->mode >> 12) < 0) 487 de->low_ino, de->mode >> 12) < 0) {
488 de_put(de);
483 goto out; 489 goto out;
490 }
484 spin_lock(&proc_subdir_lock); 491 spin_lock(&proc_subdir_lock);
485 filp->f_pos++; 492 filp->f_pos++;
486 de = de->next; 493 next = de->next;
494 de_put(de);
495 de = next;
487 } while (de); 496 } while (de);
488 spin_unlock(&proc_subdir_lock); 497 spin_unlock(&proc_subdir_lock);
489 } 498 }