Skip to content

Commit ed5fce7

Browse files
siddheshAl Viro
authored andcommitted
vfs: escape hash as well
When a filesystem is mounted with a name that starts with a #: # mount '#name' /mnt/bad -t tmpfs this will cause the entry to look like this (leading space added so that git does not strip it out): #name /mnt/bad tmpfs rw,seclabel,relatime,inode64 0 0 This breaks getmntent and any code that aims to parse fstab as well as /proc/mounts with the same logic since they need to strip leading spaces or skip over comment lines, due to which they report incorrect output or skip over the line respectively. Solve this by translating the hash character into its octal encoding equivalent so that applications can decode the name correctly. Signed-off-by: Siddhesh Poyarekar <[email protected]> Signed-off-by: Ian Kent <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent b13bacc commit ed5fce7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/proc_namespace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static void show_mnt_opts(struct seq_file *m, struct vfsmount *mnt)
8686

8787
static inline void mangle(struct seq_file *m, const char *s)
8888
{
89-
seq_escape(m, s, " \t\n\\");
89+
seq_escape(m, s, " \t\n\\#");
9090
}
9191

9292
static void show_type(struct seq_file *m, struct super_block *sb)

0 commit comments

Comments
 (0)