[PATCH 5.10 183/289] fs/proc/generic.c: fix incorrect pde_is_permanent check

From
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date
2021-05-17 15:57:02
Also in
lkml
Reply to
Greg Kroah-Hartman, 2021-05-17
From: Colin Ian King <redacted>

[ Upstream commit f4bf74d82915708208bc9d0c9bd3f769f56bfbec ]

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 (local)
Fixes: d919b33dafb3 ("proc: faster open/read/close with "permanent" files")
Signed-off-by: Colin Ian King <redacted>
Acked-by: Christian Brauner <redacted>
Reviewed-by: Alexey Dobriyan <redacted>
Cc: Greg Kroah-Hartman <redacted>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/proc/generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 6c0a05f55d6b..09e4d8a499a3 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -754,7 +754,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);
-- 
2.30.2


Thread (305 messages) 305 messages, 13 authors, last reply 2021-05-27
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help