Commit 12bac0d9 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds

proc: warn on non-existing proc entries

* warn if creation goes on to non-existent directory
* warn if removal goes on from non-existing directory
* warn if non-existing proc entry is removed
Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e17a5765
...@@ -312,8 +312,10 @@ static int __xlate_proc_name(const char *name, struct proc_dir_entry **ret, ...@@ -312,8 +312,10 @@ static int __xlate_proc_name(const char *name, struct proc_dir_entry **ret,
if (proc_match(len, cp, de)) if (proc_match(len, cp, de))
break; break;
} }
if (!de) if (!de) {
WARN(1, "name '%s'\n", name);
return -ENOENT; return -ENOENT;
}
cp += len + 1; cp += len + 1;
} }
*residual = cp; *residual = cp;
...@@ -818,8 +820,10 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent) ...@@ -818,8 +820,10 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent)
} }
} }
spin_unlock(&proc_subdir_lock); spin_unlock(&proc_subdir_lock);
if (!de) if (!de) {
WARN(1, "name '%s'\n", name);
return; return;
}
spin_lock(&de->pde_unload_lock); spin_lock(&de->pde_unload_lock);
/* /*
......
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