Skip to content

Commit dc08c58

Browse files
Johannes Kimmelkdave
Johannes Kimmel
authored andcommitted
btrfs: correctly escape subvol in btrfs_show_options()
Currently, displaying the btrfs subvol mount option doesn't escape ','. This makes parsing /proc/self/mounts and /proc/self/mountinfo ambiguous for subvolume names that contain commas. The text after the comma could be mistaken for another option (think "subvol=foo,ro", where ro is actually part of the subvolumes name). Replace the manual escape characters list with a call to seq_show_option(). Thanks to Calvin Walton for suggesting this approach. Fixes: c8d3fe0 ("Btrfs: show subvol= and subvolid= in /proc/mounts") CC: [email protected] # 5.4+ Suggested-by: Calvin Walton <[email protected]> Signed-off-by: Johannes Kimmel <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 8e587ab commit dc08c58

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

fs/btrfs/super.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -1139,8 +1139,7 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
11391139
subvol_name = btrfs_get_subvol_name_from_objectid(info,
11401140
btrfs_root_id(BTRFS_I(d_inode(dentry))->root));
11411141
if (!IS_ERR(subvol_name)) {
1142-
seq_puts(seq, ",subvol=");
1143-
seq_escape(seq, subvol_name, " \t\n\\");
1142+
seq_show_option(seq, "subvol", subvol_name);
11441143
kfree(subvol_name);
11451144
}
11461145
return 0;

0 commit comments

Comments
 (0)