Commit f4bf74d8 authored by Colin Ian King's avatar Colin Ian King Committed by Linus Torvalds

fs/proc/generic.c: fix incorrect pde_is_permanent check

Currently the pde_is_permanent() check is being run on root multiple times
rather than on the next proc directory entry.  This looks like a
copy-paste error.  Fix this by replacing root with next.

Addresses-Coverity: ("Copy-paste error")
Link: https://lkml.kernel.org/r/20210318122633.14222-1-colin.king@canonical.com
Fixes: d919b33d ("proc: faster open/read/close with "permanent" files")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Acked-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
Reviewed-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0214967a
...@@ -756,7 +756,7 @@ int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) ...@@ -756,7 +756,7 @@ int remove_proc_subtree(const char *name, struct proc_dir_entry *parent)
while (1) { while (1) {
next = pde_subdir_first(de); next = pde_subdir_first(de);
if (next) { if (next) {
if (unlikely(pde_is_permanent(root))) { if (unlikely(pde_is_permanent(next))) {
write_unlock(&proc_subdir_lock); write_unlock(&proc_subdir_lock);
WARN(1, "removing permanent /proc entry '%s/%s'", WARN(1, "removing permanent /proc entry '%s/%s'",
next->parent->name, next->name); next->parent->name, next->name);
......
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