diff options
Diffstat (limited to 'fs/proc/generic.c')
-rw-r--r-- | fs/proc/generic.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 3c6f5669523a..8b406e21a258 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -388,20 +388,18 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir, | |||
388 | 388 | ||
389 | lock_kernel(); | 389 | lock_kernel(); |
390 | spin_lock(&proc_subdir_lock); | 390 | spin_lock(&proc_subdir_lock); |
391 | if (de) { | 391 | for (de = de->subdir; de ; de = de->next) { |
392 | for (de = de->subdir; de ; de = de->next) { | 392 | if (de->namelen != dentry->d_name.len) |
393 | if (de->namelen != dentry->d_name.len) | 393 | continue; |
394 | continue; | 394 | if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { |
395 | if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { | 395 | unsigned int ino; |
396 | unsigned int ino; | 396 | |
397 | 397 | ino = de->low_ino; | |
398 | ino = de->low_ino; | 398 | de_get(de); |
399 | de_get(de); | 399 | spin_unlock(&proc_subdir_lock); |
400 | spin_unlock(&proc_subdir_lock); | 400 | error = -EINVAL; |
401 | error = -EINVAL; | 401 | inode = proc_get_inode(dir->i_sb, ino, de); |
402 | inode = proc_get_inode(dir->i_sb, ino, de); | 402 | goto out_unlock; |
403 | goto out_unlock; | ||
404 | } | ||
405 | } | 403 | } |
406 | } | 404 | } |
407 | spin_unlock(&proc_subdir_lock); | 405 | spin_unlock(&proc_subdir_lock); |
@@ -413,7 +411,8 @@ out_unlock: | |||
413 | d_add(dentry, inode); | 411 | d_add(dentry, inode); |
414 | return NULL; | 412 | return NULL; |
415 | } | 413 | } |
416 | de_put(de); | 414 | if (de) |
415 | de_put(de); | ||
417 | return ERR_PTR(error); | 416 | return ERR_PTR(error); |
418 | } | 417 | } |
419 | 418 | ||
@@ -443,10 +442,6 @@ int proc_readdir_de(struct proc_dir_entry *de, struct file *filp, void *dirent, | |||
443 | lock_kernel(); | 442 | lock_kernel(); |
444 | 443 | ||
445 | ino = inode->i_ino; | 444 | ino = inode->i_ino; |
446 | if (!de) { | ||
447 | ret = -EINVAL; | ||
448 | goto out; | ||
449 | } | ||
450 | i = filp->f_pos; | 445 | i = filp->f_pos; |
451 | switch (i) { | 446 | switch (i) { |
452 | case 0: | 447 | case 0: |