Skip to content

Commit f7ef7de

Browse files
committed
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>
1 parent 49c9e09 commit f7ef7de

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • security/landlock

security/landlock/fs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,6 @@ static bool is_access_to_paths_allowed(
838838
* restriction.
839839
*/
840840
while (true) {
841-
struct dentry *parent_dentry;
842841
const struct landlock_rule *rule;
843842

844843
/*
@@ -931,7 +930,9 @@ static bool is_access_to_paths_allowed(
931930
walker_path.dentry = walker_path.mnt->mnt_root;
932931
dget(walker_path.dentry);
933932
} else {
934-
parent_dentry = dget_parent(walker_path.dentry);
933+
struct dentry *const parent_dentry =
934+
dget_parent(walker_path.dentry);
935+
935936
dput(walker_path.dentry);
936937
walker_path.dentry = parent_dentry;
937938
}

0 commit comments

Comments
 (0)