summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}