From: Mickaël Salaün Date: Fri, 28 Nov 2025 17:21:57 +0000 (+0100) Subject: landlock: Improve variable scope X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f7ef7de6b9bcec1314af2cdcfd0c952eadd6a779;p=thirdparty%2Fkernel%2Fstable.git landlock: Improve variable scope This is now possible thanks to the disconnected directory fix. Cc: Günther Noack Cc: Song Liu Cc: Tingmao Wang Link: https://lore.kernel.org/r/20251128172200.760753-3-mic@digikod.net Signed-off-by: Mickaël Salaün --- 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; }