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