Skip to content

Commit 5eb9871

Browse files
Miklos Szeredibrauner
authored andcommitted
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: 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]>
1 parent b06ddfe commit 5eb9871

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
@@ -5087,30 +5087,29 @@ static int statmount_mnt_opts(struct kstatmount *s, struct seq_file *seq)
50875087
{
50885088
struct vfsmount *mnt = s->mnt;
50895089
struct super_block *sb = mnt->mnt_sb;
5090+
size_t start = seq->count;
50905091
int err;
50915092

5092-
if (sb->s_op->show_options) {
5093-
size_t start = seq->count;
5094-
5095-
err = security_sb_show_options(seq, sb);
5096-
if (err)
5097-
return err;
5093+
err = security_sb_show_options(seq, sb);
5094+
if (err)
5095+
return err;
50985096

5097+
if (sb->s_op->show_options) {
50995098
err = sb->s_op->show_options(seq, mnt->mnt_root);
51005099
if (err)
51015100
return err;
5101+
}
51025102

5103-
if (unlikely(seq_has_overflowed(seq)))
5104-
return -EAGAIN;
5103+
if (unlikely(seq_has_overflowed(seq)))
5104+
return -EAGAIN;
51055105

5106-
if (seq->count == start)
5107-
return 0;
5106+
if (seq->count == start)
5107+
return 0;
51085108

5109-
/* skip leading comma */
5110-
memmove(seq->buf + start, seq->buf + start + 1,
5111-
seq->count - start - 1);
5112-
seq->count--;
5113-
}
5109+
/* skip leading comma */
5110+
memmove(seq->buf + start, seq->buf + start + 1,
5111+
seq->count - start - 1);
5112+
seq->count--;
51145113

51155114
return 0;
51165115
}

0 commit comments

Comments
 (0)