summaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-01-30 20:37:51 -0800
committerEric W. Biederman <ebiederm@xmission.com>2012-02-01 19:20:40 -0800
commit0eb97f38d2bfaea289b44c5140a7b04e7b369bad (patch)
treee9d0d1ae9ec236f32da3642723111c86c80d530a /fs/proc
parent51f72f4a0f92e4abde33a8bca0fac9667575d035 (diff)
downloadlinux-0eb97f38d2bfaea289b44c5140a7b04e7b369bad.tar.bz2
sysctl: Correct error return from get_subdir
When insert_header fails ensure we return the proper error value from get_subdir. In practice nothing cares, but there is no need to be sloppy. Reported-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/proc_sysctl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index ebe8b3076db7..722ec116208d 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -869,6 +869,7 @@ static struct ctl_dir *get_subdir(struct ctl_dir *dir,
{
struct ctl_table_set *set = dir->header.set;
struct ctl_dir *subdir, *new = NULL;
+ int err;
spin_lock(&sysctl_lock);
subdir = find_subdir(dir, name, namelen);
@@ -890,7 +891,9 @@ static struct ctl_dir *get_subdir(struct ctl_dir *dir,
if (PTR_ERR(subdir) != -ENOENT)
goto failed;
- if (insert_header(dir, &new->header))
+ err = insert_header(dir, &new->header);
+ subdir = ERR_PTR(err);
+ if (err)
goto failed;
subdir = new;
found: