[Devel] [PATCH RHEL10 COMMIT] ms/fs: fix adding security options to statmount.mnt_opt

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jul 7 14:59:36 MSK 2026


The commit is pushed to "branch-rh10-6.12.0-211.30.1.14.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.30.1.14.1.vz10
------>
commit 07dad8651e766022bb7506c9cec5b6a484fdd426
Author: Miklos Szeredi <mszeredi at redhat.com>
Date:   Sun May 24 18:26:02 2026 +0300

    ms/fs: fix adding security options to statmount.mnt_opt
    
    Prepending security options was made conditional on sb->s_op->show_options,
    but security options are independent of sb options.
    
    Fixes: 056d33137bf9 ("fs: prepend statmount.mnt_opts string with security_sb_mnt_opts()")
    Fixes: f9af549d1fd3 ("fs: export mount options via statmount()")
    Cc: stable at vger.kernel.org # v6.11
    Signed-off-by: Miklos Szeredi <mszeredi at redhat.com>
    Link: https://lore.kernel.org/r/20250129151253.33241-1-mszeredi@redhat.com
    Signed-off-by: Christian Brauner <brauner at kernel.org>
    
    (cherry picked from commit 5eb987105357cb7cfa7cf3b1e2f66d5c0977e412)
    https://virtuozzo.atlassian.net/browse/VSTOR-132443
    Feature: Fix selftests
    Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
    Reviewed-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
---
 fs/namespace.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 9dc36c065013f..0f4a3668e558d 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -5353,30 +5353,29 @@ static int statmount_mnt_opts(struct kstatmount *s, struct seq_file *seq)
 {
 	struct vfsmount *mnt = s->mnt;
 	struct super_block *sb = mnt->mnt_sb;
+	size_t start = seq->count;
 	int err;
 
-	if (sb->s_op->show_options) {
-		size_t start = seq->count;
-
-		err = security_sb_show_options(seq, sb);
-		if (err)
-			return err;
+	err = security_sb_show_options(seq, sb);
+	if (err)
+		return err;
 
+	if (sb->s_op->show_options) {
 		err = sb->s_op->show_options(seq, mnt->mnt_root);
 		if (err)
 			return err;
+	}
 
-		if (unlikely(seq_has_overflowed(seq)))
-			return -EAGAIN;
+	if (unlikely(seq_has_overflowed(seq)))
+		return -EAGAIN;
 
-		if (seq->count == start)
-			return 0;
+	if (seq->count == start)
+		return 0;
 
-		/* skip leading comma */
-		memmove(seq->buf + start, seq->buf + start + 1,
-			seq->count - start - 1);
-		seq->count--;
-	}
+	/* skip leading comma */
+	memmove(seq->buf + start, seq->buf + start + 1,
+		seq->count - start - 1);
+	seq->count--;
 
 	return 0;
 }


More information about the Devel mailing list