Skip to content

Commit 68e69a2

Browse files
Johannes Kimmelvijay-suman
authored andcommitted
btrfs: correctly escape subvol in btrfs_show_options()
commit dc08c58696f8555e4a802f1f23c894a330d80ab7 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit cdd459a58bb673852bdbf4d68f46b74fe2ac1849) Signed-off-by: Vijayendra Suman <[email protected]>
1 parent 26bea35 commit 68e69a2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

fs/btrfs/super.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,8 +1559,7 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
15591559
subvol_name = btrfs_get_subvol_name_from_objectid(info,
15601560
BTRFS_I(d_inode(dentry))->root->root_key.objectid);
15611561
if (!IS_ERR(subvol_name)) {
1562-
seq_puts(seq, ",subvol=");
1563-
seq_escape(seq, subvol_name, " \t\n\\");
1562+
seq_show_option(seq, "subvol", subvol_name);
15641563
kfree(subvol_name);
15651564
}
15661565
return 0;

0 commit comments

Comments
 (0)