Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+3 -2
+3 -2
security/landlock/fs.c
··· 838 838 * restriction. 839 839 */ 840 840 while (true) { 841 - struct dentry *parent_dentry; 842 841 const struct landlock_rule *rule; 843 842 844 843 /* ··· 930 931 walker_path.dentry = walker_path.mnt->mnt_root; 931 932 dget(walker_path.dentry); 932 933 } else { 933 - parent_dentry = dget_parent(walker_path.dentry); 934 + struct dentry *const parent_dentry = 935 + dget_parent(walker_path.dentry); 936 + 934 937 dput(walker_path.dentry); 935 938 walker_path.dentry = parent_dentry; 936 939 }