if (!p)
goto out;
- ret = sysctl_follow_link(&h, &p, current->nsproxy);
- err = ERR_PTR(ret);
- if (ret)
- goto out;
+ if (S_ISLNK(p->mode)) {
+ ret = sysctl_follow_link(&h, &p, current->nsproxy);
+ err = ERR_PTR(ret);
+ if (ret)
+ goto out;
+ }
err = ERR_PTR(-ENOMEM);
inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p);
int err, ret = 0;
head = sysctl_head_grab(head);
- /* It is not an error if we can not follow the link ignore it */
- err = sysctl_follow_link(&head, &table, current->nsproxy);
- if (err)
- goto out;
+ if (S_ISLNK(table->mode)) {
+ /* It is not an error if we can not follow the link ignore it */
+ err = sysctl_follow_link(&head, &table, current->nsproxy);
+ if (err)
+ goto out;
+ }
ret = proc_sys_fill_cache(filp, dirent, filldir, head, table);
out:
struct ctl_dir *dir;
int ret;
- /* Get out quickly if not a link */
- if (!S_ISLNK((*pentry)->mode))
- return 0;
-
ret = 0;
spin_lock(&sysctl_lock);
root = (*pentry)->data;