Skip to content

Commit 7db0365

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 45439a8 commit 7db0365

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
@@ -5020,30 +5020,29 @@ static int statmount_mnt_opts(struct kstatmount *s, struct seq_file *seq)
50205020
{
50215021
struct vfsmount *mnt = s->mnt;
50225022
struct super_block *sb = mnt->mnt_sb;
5023+
size_t start = seq->count;
50235024
int err;
50245025

5025-
if (sb->s_op->show_options) {
5026-
size_t start = seq->count;
5027-
5028-
err = security_sb_show_options(seq, sb);
5029-
if (err)
5030-
return err;
5026+
err = security_sb_show_options(seq, sb);
5027+
if (err)
5028+
return err;
50315029

5030+
if (sb->s_op->show_options) {
50325031
err = sb->s_op->show_options(seq, mnt->mnt_root);
50335032
if (err)
50345033
return err;
5034+
}
50355035

5036-
if (unlikely(seq_has_overflowed(seq)))
5037-
return -EAGAIN;
5036+
if (unlikely(seq_has_overflowed(seq)))
5037+
return -EAGAIN;
50385038

5039-
if (seq->count == start)
5040-
return 0;
5039+
if (seq->count == start)
5040+
return 0;
50415041

5042-
/* skip leading comma */
5043-
memmove(seq->buf + start, seq->buf + start + 1,
5044-
seq->count - start - 1);
5045-
seq->count--;
5046-
}
5042+
/* skip leading comma */
5043+
memmove(seq->buf + start, seq->buf + start + 1,
5044+
seq->count - start - 1);
5045+
seq->count--;
50475046

50485047
return 0;
50495048
}

0 commit comments

Comments
 (0)