From: Miklos Szeredi <[email protected]>

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: [email protected] # v6.11
Signed-off-by: Miklos Szeredi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Christian Brauner <[email protected]>

(cherry picked from commit 5eb987105357cb7cfa7cf3b1e2f66d5c0977e412)
Signed-off-by: Eva Kurchatova <[email protected]>

https://virtuozzo.atlassian.net/browse/VSTOR-132443
Feature: Fix selftests
---
 fs/namespace.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 8f8161a555a6..a66e074c68a9 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -5302,30 +5302,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;
 }
-- 
2.54.0

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to