cifs: escape spaces in share names

Commit 653a5efb84 ("cifs: update super_operations to show_devname")
introduced the display of devname for cifs mounts. However, when mounting
a share which has a whitespace in the name, that exact share name is also
displayed in mountinfo. Make sure that all whitespace is escaped.

Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
CC: <stable@vger.kernel.org> # 5.11+
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
Maciek Borzecki 2021-04-06 17:02:29 +02:00 committed by Steve French
parent d135be0a7f
commit 0fc9322ab5
1 changed files with 2 additions and 1 deletions

View File

@ -476,7 +476,8 @@ static int cifs_show_devname(struct seq_file *m, struct dentry *root)
seq_puts(m, "none");
else {
convert_delimiter(devname, '/');
seq_puts(m, devname);
/* escape all spaces in share names */
seq_escape(m, devname, " \t");
kfree(devname);
}
return 0;