]> git.baikalelectronics.ru Git - kernel.git/commit
vfs: escape hash as well
authorSiddhesh Poyarekar <siddhesh@gotplt.org>
Tue, 28 Jun 2022 00:30:58 +0000 (08:30 +0800)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 28 Jun 2022 17:58:05 +0000 (13:58 -0400)
commit32cf2d811f0c3d3cec018b4fed76c7b103d1b40f
tree9b37e8c3cdf3aed17a7b94c6a6c3f3a025f2ff06
parent71374b58ebc7666369d670c06d1176f81c437c59
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>
fs/proc_namespace.c