diff options
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/proc_sysctl.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index e5601dc24088..a7708b7c957f 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c | |||
@@ -451,10 +451,12 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry, | |||
451 | if (!p) | 451 | if (!p) |
452 | goto out; | 452 | goto out; |
453 | 453 | ||
454 | ret = sysctl_follow_link(&h, &p, current->nsproxy); | 454 | if (S_ISLNK(p->mode)) { |
455 | err = ERR_PTR(ret); | 455 | ret = sysctl_follow_link(&h, &p, current->nsproxy); |
456 | if (ret) | 456 | err = ERR_PTR(ret); |
457 | goto out; | 457 | if (ret) |
458 | goto out; | ||
459 | } | ||
458 | 460 | ||
459 | err = ERR_PTR(-ENOMEM); | 461 | err = ERR_PTR(-ENOMEM); |
460 | inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p); | 462 | inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p); |
@@ -601,10 +603,12 @@ static int proc_sys_link_fill_cache(struct file *filp, void *dirent, | |||
601 | int err, ret = 0; | 603 | int err, ret = 0; |
602 | head = sysctl_head_grab(head); | 604 | head = sysctl_head_grab(head); |
603 | 605 | ||
604 | /* It is not an error if we can not follow the link ignore it */ | 606 | if (S_ISLNK(table->mode)) { |
605 | err = sysctl_follow_link(&head, &table, current->nsproxy); | 607 | /* It is not an error if we can not follow the link ignore it */ |
606 | if (err) | 608 | err = sysctl_follow_link(&head, &table, current->nsproxy); |
607 | goto out; | 609 | if (err) |
610 | goto out; | ||
611 | } | ||
608 | 612 | ||
609 | ret = proc_sys_fill_cache(filp, dirent, filldir, head, table); | 613 | ret = proc_sys_fill_cache(filp, dirent, filldir, head, table); |
610 | out: | 614 | out: |
@@ -950,10 +954,6 @@ static int sysctl_follow_link(struct ctl_table_header **phead, | |||
950 | struct ctl_dir *dir; | 954 | struct ctl_dir *dir; |
951 | int ret; | 955 | int ret; |
952 | 956 | ||
953 | /* Get out quickly if not a link */ | ||
954 | if (!S_ISLNK((*pentry)->mode)) | ||
955 | return 0; | ||
956 | |||
957 | ret = 0; | 957 | ret = 0; |
958 | spin_lock(&sysctl_lock); | 958 | spin_lock(&sysctl_lock); |
959 | root = (*pentry)->data; | 959 | root = (*pentry)->data; |