Commit 0eb97f38 authored by Eric W. Biederman's avatar Eric W. Biederman

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: default avatarLucian Adrian Grijincu <lucian.grijincu@gmail.com>
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
parent 51f72f4a
...@@ -869,6 +869,7 @@ static struct ctl_dir *get_subdir(struct ctl_dir *dir, ...@@ -869,6 +869,7 @@ static struct ctl_dir *get_subdir(struct ctl_dir *dir,
{ {
struct ctl_table_set *set = dir->header.set; struct ctl_table_set *set = dir->header.set;
struct ctl_dir *subdir, *new = NULL; struct ctl_dir *subdir, *new = NULL;
int err;
spin_lock(&sysctl_lock); spin_lock(&sysctl_lock);
subdir = find_subdir(dir, name, namelen); subdir = find_subdir(dir, name, namelen);
...@@ -890,7 +891,9 @@ static struct ctl_dir *get_subdir(struct ctl_dir *dir, ...@@ -890,7 +891,9 @@ static struct ctl_dir *get_subdir(struct ctl_dir *dir,
if (PTR_ERR(subdir) != -ENOENT) if (PTR_ERR(subdir) != -ENOENT)
goto failed; goto failed;
if (insert_header(dir, &new->header)) err = insert_header(dir, &new->header);
subdir = ERR_PTR(err);
if (err)
goto failed; goto failed;
subdir = new; subdir = new;
found: found:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment