Skip to content

Commit 4752f2e

Browse files
Miklos Szeredigregkh
authored andcommitted
fs: fix adding security options to statmount.mnt_opt
commit 5eb9871 upstream. Prepending security options was made conditional on sb->s_op->show_options, but security options are independent of sb options. Fixes: 056d331 ("fs: prepend statmount.mnt_opts string with security_sb_mnt_opts()") Fixes: f9af549 ("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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 391d9e2 commit 4752f2e

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

fs/namespace.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5037,30 +5037,29 @@ static int statmount_mnt_opts(struct kstatmount *s, struct seq_file *seq)
50375037
{
50385038
struct vfsmount *mnt = s->mnt;
50395039
struct super_block *sb = mnt->mnt_sb;
5040+
size_t start = seq->count;
50405041
int err;
50415042

5042-
if (sb->s_op->show_options) {
5043-
size_t start = seq->count;
5044-
5045-
err = security_sb_show_options(seq, sb);
5046-
if (err)
5047-
return err;
5043+
err = security_sb_show_options(seq, sb);
5044+
if (err)
5045+
return err;
50485046

5047+
if (sb->s_op->show_options) {
50495048
err = sb->s_op->show_options(seq, mnt->mnt_root);
50505049
if (err)
50515050
return err;
5051+
}
50525052

5053-
if (unlikely(seq_has_overflowed(seq)))
5054-
return -EAGAIN;
5053+
if (unlikely(seq_has_overflowed(seq)))
5054+
return -EAGAIN;
50555055

5056-
if (seq->count == start)
5057-
return 0;
5056+
if (seq->count == start)
5057+
return 0;
50585058

5059-
/* skip leading comma */
5060-
memmove(seq->buf + start, seq->buf + start + 1,
5061-
seq->count - start - 1);
5062-
seq->count--;
5063-
}
5059+
/* skip leading comma */
5060+
memmove(seq->buf + start, seq->buf + start + 1,
5061+
seq->count - start - 1);
5062+
seq->count--;
50645063

50655064
return 0;
50665065
}

0 commit comments

Comments
 (0)