]> git.baikalelectronics.ru Git - kernel.git/commitdiff
fs/proc/generic.c: fix incorrect pde_is_permanent check
authorColin Ian King <colin.king@canonical.com>
Fri, 7 May 2021 01:02:10 +0000 (18:02 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 7 May 2021 02:24:11 +0000 (19:24 -0700)
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: e04c06c0e147 ("proc: faster open/read/close with "permanent" files")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Reviewed-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/generic.c

index bc86aa87cc41a8faaafefd5dfc280c2271a54fdd..5600da30e289b24ef23f856f2092ecdcd022a755 100644 (file)
@@ -756,7 +756,7 @@ int remove_proc_subtree(const char *name, struct proc_dir_entry *parent)
        while (1) {
                next = pde_subdir_first(de);
                if (next) {
-                       if (unlikely(pde_is_permanent(root))) {
+                       if (unlikely(pde_is_permanent(next))) {
                                write_unlock(&proc_subdir_lock);
                                WARN(1, "removing permanent /proc entry '%s/%s'",
                                        next->parent->name, next->name);