From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-190e.mail.infomaniak.ch (smtp-190e.mail.infomaniak.ch [185.125.25.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4649033D6FB for ; Wed, 26 Nov 2025 19:12:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.25.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764184337; cv=none; b=hB/u1GpUCkzUi0csVx6MSVJvKuoYSqYG2Vh1oDU+c7inkpB3YwkhK2Uk6Ekx4uo7w/Rc+OF6weUd8llf5JVB8ExQRmNsBSIz8fIaE5fP2DLngFUuBdTX17RMthh2MUFqLFEzIC97gcOjbt5e0pPtvpaEWFvg6MIrYu3D14HEGIs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764184337; c=relaxed/simple; bh=kEosmMHPCD5lhTv1eR2E+OOD6sWFunYUpGLFsv37ics=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XJRx6yFtB3WZZfK1TmDF3FgBvArFoFY6aXEPBnseuvWKwAMxqxPLnKNN77A61z/VJrGGt6ZNdpt5AxO+VAlIv/zCu8cUNA8Tk91SfDqA/jII0Mo6XQeJYW2xXat38G96DG6RWrLyj9OpkQ5rbcyogOZrMPMfF8ILSe00DsAm4t0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net; spf=pass smtp.mailfrom=digikod.net; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b=i5WPRww7; arc=none smtp.client-ip=185.125.25.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=digikod.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="i5WPRww7" Received: from smtp-3-0001.mail.infomaniak.ch (smtp-3-0001.mail.infomaniak.ch [10.4.36.108]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4dGq1f07NJzJ5j; Wed, 26 Nov 2025 20:12:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digikod.net; s=20191114; t=1764184325; bh=ueIO+4dm8tI/FD4qKaIisBdzaOP4AclNwA9F9lhXSnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i5WPRww7Xdq49xFqRkROcHOJBCA0iTXKxSl9IOy6smEWCRHZuqYdym5ol+qGuZrhW P46DVSmu8lC/S4N8OpaBbq8u/ZMiWwLmu6GdC0g1BNZdlbufGLFoU9T0J3zVy8zpcI 1wBUGkCgrVQ9uaTCc4YX9nwFvWg+cWnZmuaPfQcE= Received: from unknown by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4dGq1d3Bxnzskv; Wed, 26 Nov 2025 20:12:05 +0100 (CET) From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= To: =?UTF-8?q?G=C3=BCnther=20Noack?= , Tingmao Wang Cc: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Al Viro , Ben Scarlato , Christian Brauner , Jann Horn , Jeff Xu , Justin Suess , Mikhail Ivanov , Paul Moore , Song Liu , linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org Subject: [PATCH v4 2/4] landlock: Improve variable scope Date: Wed, 26 Nov 2025 20:11:55 +0100 Message-ID: <20251126191159.3530363-3-mic@digikod.net> In-Reply-To: <20251126191159.3530363-1-mic@digikod.net> References: <20251126191159.3530363-1-mic@digikod.net> Precedence: bulk X-Mailing-List: linux-security-module@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Infomaniak-Routing: alpha This is now possible thanks to the disconnected directory fix. Cc: Günther Noack Cc: Song Liu Cc: Tingmao Wang Signed-off-by: Mickaël Salaün --- Changes since v3: - New patch extracted from the previous one. --- security/landlock/fs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/security/landlock/fs.c b/security/landlock/fs.c index 26d5c274a4c9..ee2fa7382a9b 100644 --- a/security/landlock/fs.c +++ b/security/landlock/fs.c @@ -837,7 +837,6 @@ static bool is_access_to_paths_allowed( * restriction. */ while (true) { - struct dentry *parent_dentry; const struct landlock_rule *rule; /* @@ -930,7 +929,9 @@ static bool is_access_to_paths_allowed( 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; } -- 2.51.0