summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMickaël Salaün <mic@digikod.net>2025-11-28 18:21:57 +0100
committerMickaël Salaün <mic@digikod.net>2025-11-28 18:27:06 +0100
commitf7ef7de6b9bcec1314af2cdcfd0c952eadd6a779 (patch)
treec3b2eb0e02aac346eaed792a682f640cd90fba5b
parent49c9e09d961025b22e61ef9ad56aa1c21b6ce2f1 (diff)
landlock: Improve variable scope
This is now possible thanks to the disconnected directory fix. Cc: Günther Noack <gnoack@google.com> Cc: Song Liu <song@kernel.org> Cc: Tingmao Wang <m@maowtm.org> Link: https://lore.kernel.org/r/20251128172200.760753-3-mic@digikod.net Signed-off-by: Mickaël Salaün <mic@digikod.net>
-rw-r--r--security/landlock/fs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/security/landlock/fs.c b/security/landlock/fs.c
index 2521acde6039..6fadb54496a0 100644
--- a/security/landlock/fs.c
+++ b/security/landlock/fs.c
@@ -838,7 +838,6 @@ static bool is_access_to_paths_allowed(
* restriction.
*/
while (true) {
- struct dentry *parent_dentry;
const struct landlock_rule *rule;
/*
@@ -931,7 +930,9 @@ jump_up:
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;
}