summaryrefslogtreecommitdiff
path: root/fs/proc_namespace.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@gotplt.org>2022-06-28 08:30:58 +0800
committerAl Viro <viro@zeniv.linux.org.uk>2022-06-28 13:58:05 -0400
commited5fce76b5ea40c87b44cafbe4f3222da8ec981a (patch)
tree9b37e8c3cdf3aed17a7b94c6a6c3f3a025f2ff06 /fs/proc_namespace.c
parentb13baccc3850ca8b8cccbf8ed9912dbaa0fdf7f3 (diff)
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 <siddhesh@gotplt.org> Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/proc_namespace.c')
-rw-r--r--fs/proc_namespace.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 49650e54d2f8..846f9455ae22 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -86,7 +86,7 @@ static void show_mnt_opts(struct seq_file *m, struct vfsmount *mnt)
static inline void mangle(struct seq_file *m, const char *s)
{
- seq_escape(m, s, " \t\n\\");
+ seq_escape(m, s, " \t\n\\#");
}
static void show_type(struct seq_file *m, struct super_block *sb)