Skip to content

Commit

Permalink
proc: warn on non-existing proc entries
Browse files Browse the repository at this point in the history
* 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: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Alexey Dobriyan authored and torvalds committed Mar 6, 2010
1 parent e17a576 commit 12bac0d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fs/proc/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,10 @@ static int __xlate_proc_name(const char *name, struct proc_dir_entry **ret,
if (proc_match(len, cp, de))
break;
}
if (!de)
if (!de) {
WARN(1, "name '%s'\n", name);
return -ENOENT;
}
cp += len + 1;
}
*residual = cp;
Expand Down Expand Up @@ -818,8 +820,10 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent)
}
}
spin_unlock(&proc_subdir_lock);
if (!de)
if (!de) {
WARN(1, "name '%s'\n", name);
return;
}

spin_lock(&de->pde_unload_lock);
/*
Expand Down

0 comments on commit 12bac0d

Please sign in to comment.