[PATCH v4 2/4] landlock: Improve variable scope
Mickaël Salaün
mic at digikod.net
Wed Nov 26 19:11:55 UTC 2025
This is now possible thanks to the disconnected directory fix.
Cc: Günther Noack <gnoack at google.com>
Cc: Song Liu <song at kernel.org>
Cc: Tingmao Wang <m at maowtm.org>
Signed-off-by: Mickaël Salaün <mic at digikod.net>
---
Changes since v3:
- New patch extracted from the previous one.
---
security/landlock/fs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/security/landlock/fs.c b/security/landlock/fs.c
index 26d5c274a4c9..ee2fa7382a9b 100644
--- a/security/landlock/fs.c
+++ b/security/landlock/fs.c
@@ -837,7 +837,6 @@ static bool is_access_to_paths_allowed(
* restriction.
*/
while (true) {
- struct dentry *parent_dentry;
const struct landlock_rule *rule;
/*
@@ -930,7 +929,9 @@ static bool is_access_to_paths_allowed(
walker_path.dentry = walker_path.mnt->mnt_root;
dget(walker_path.dentry);
} else {
- parent_dentry = dget_parent(walker_path.dentry);
+ struct dentry *const parent_dentry =
+ dget_parent(walker_path.dentry);
+
dput(walker_path.dentry);
walker_path.dentry = parent_dentry;
}
--
2.51.0
More information about the Linux-security-module-archive
mailing list