diff mbox series

[03/13] fs: Convert mount_too_revealing() to new s_iflags handling functions

Message ID 20240807183003.23562-3-jack@suse.cz (mailing list archive)
State New
Headers show
Series fs: generic filesystem shutdown handling | expand

Commit Message

Jan Kara Aug. 7, 2024, 6:29 p.m. UTC
Convert mount_too_revealing() to use the new functions for handling
sb->s_iflags and new bit constants.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/namespace.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/fs/namespace.c b/fs/namespace.c
index 328087a4df8a..75153f61a908 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -5623,21 +5623,18 @@  static bool mnt_already_visible(struct mnt_namespace *ns,
 
 static bool mount_too_revealing(const struct super_block *sb, int *new_mnt_flags)
 {
-	const unsigned long required_iflags = SB_I_NOEXEC | SB_I_NODEV;
 	struct mnt_namespace *ns = current->nsproxy->mnt_ns;
-	unsigned long s_iflags;
 
 	if (ns->user_ns == &init_user_ns)
 		return false;
 
 	/* Can this filesystem be too revealing? */
-	s_iflags = sb->s_iflags;
-	if (!(s_iflags & SB_I_USERNS_VISIBLE))
+	if (!sb_test_iflag(sb, _SB_I_USERNS_VISIBLE))
 		return false;
 
-	if ((s_iflags & required_iflags) != required_iflags) {
-		WARN_ONCE(1, "Expected s_iflags to contain 0x%lx\n",
-			  required_iflags);
+	if (!sb_test_iflag(sb, _SB_I_NOEXEC) || !sb_test_iflag(sb, _SB_I_NODEV)) {
+		WARN_ONCE(1, "Expected s_iflags to contain SB_I_NOEXEC and "
+			  "SB_I_NODEV\n");
 		return true;
 	}