Skip to content

Commit

Permalink
sysctl: Correct error return from get_subdir
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric W. Biederman committed Feb 2, 2012
1 parent 51f72f4 commit 0eb97f3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/proc/proc_sysctl.c
Original file line number Diff line number Diff line change
@@ -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:

0 comments on commit 0eb97f3

Please sign in to comment.