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>
{
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);
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: