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>
This commit is contained in:
Mickaël Salaün
2025-11-28 18:21:57 +01:00
parent 49c9e09d96
commit f7ef7de6b9

View File

@@ -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;
}