linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs: escape spaces in share names
@ 2021-04-06 15:02 Maciek Borzecki
  2021-04-07 18:56 ` Steve French
  0 siblings, 1 reply; 2+ messages in thread
From: Maciek Borzecki @ 2021-04-06 15:02 UTC (permalink / raw)
  To: linux-kernel, linux-cifs, Steve French; +Cc: Maciek Borzecki

Commit 653a5efb849a ("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>
---
 fs/cifs/cifsfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 099ad9f3660bb28db1b6a9aea9538282b41c6455..3c6cb85b95e207df222248f10cc9df937cdda24e 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -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, " ");
 		kfree(devname);
 	}
 	return 0;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cifs: escape spaces in share names
  2021-04-06 15:02 [PATCH] cifs: escape spaces in share names Maciek Borzecki
@ 2021-04-07 18:56 ` Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2021-04-07 18:56 UTC (permalink / raw)
  To: Maciek Borzecki; +Cc: LKML, CIFS, Steve French

[-- Attachment #1: Type: text/plain, Size: 1390 bytes --]

Good catch - added one other minor thing, whitespace in share name
could be a space or a tab, so changed that line to:

+               seq_escape(m, devname, " \t");

from
+               seq_escape(m, devname, " ");

On Wed, Apr 7, 2021 at 12:35 AM Maciek Borzecki
<maciek.borzecki@gmail.com> wrote:
>
> Commit 653a5efb849a ("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>
> ---
>  fs/cifs/cifsfs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
> index 099ad9f3660bb28db1b6a9aea9538282b41c6455..3c6cb85b95e207df222248f10cc9df937cdda24e 100644
> --- a/fs/cifs/cifsfs.c
> +++ b/fs/cifs/cifsfs.c
> @@ -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, " ");
>                 kfree(devname);
>         }
>         return 0;
> --
> 2.31.1
>


-- 
Thanks,

Steve

[-- Attachment #2: 0001-cifs-escape-spaces-in-share-names.patch --]
[-- Type: text/x-patch, Size: 1218 bytes --]

From 1ee4f33ffa830267d324b0d547facd25dd683a12 Mon Sep 17 00:00:00 2001
From: Maciek Borzecki <maciek.borzecki@gmail.com>
Date: Tue, 6 Apr 2021 17:02:29 +0200
Subject: [PATCH] cifs: escape spaces in share names

Commit 653a5efb849a ("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>
---
 fs/cifs/cifsfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 099ad9f3660b..3c6cb85b95e2 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -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;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-07 18:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 15:02 [PATCH] cifs: escape spaces in share names Maciek Borzecki
2021-04-07 18:56 ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).