* [PATCH] cifs: remove any preceding delimiter from prefix_path
@ 2016-02-08 8:14 Sachin Prabhu
[not found] ` <1454919241-28048-1-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Sachin Prabhu @ 2016-02-08 8:14 UTC (permalink / raw)
To: linux-cifs
We currently do not check if any delimiter exists before the prefix
path in cifs_compose_mount_options(). Consequently when building the
devname using cifs_build_devname() we can end up with multiple
delimiters separating the UNC and the prefix path.
An issue was reported by the customer mounting a folder within a DFS
share from a Netapp server which uses McAfee antivirus. We have
narrowed down the cause to the use of double backslashes in the file
name used to open the file. This was determined to be caused because of
additional delimiters as a result of the bug.
In addition to changes in cifs_build_devname(), we also fix
cifs_parse_devname() to ignore any preceding delimiter for the prefix
path.
The problem was originally reported on RHEL 6 in RHEL bz 1252721. This
is the upstream version of the fix. The fix was confirmed by looking at
the packet capture of a DFS mount.
Signed-off-by: Sachin Prabhu <sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
fs/cifs/cifs_dfs_ref.c | 6 +++++-
fs/cifs/connect.c | 8 ++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index 7dc886c..10db1fe 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -151,8 +151,12 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
if (sb_mountdata == NULL)
return ERR_PTR(-EINVAL);
- if (strlen(fullpath) - ref->path_consumed)
+ if (strlen(fullpath) - ref->path_consumed) {
prepath = fullpath + ref->path_consumed;
+ /* skip initial delimiter */
+ if (*prepath == '/' || *prepath == '\\')
+ prepath++;
+ }
*devname = cifs_build_devname(ref->node_name, prepath);
if (IS_ERR(*devname)) {
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 4fbd92d..2acb4bb 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1196,8 +1196,12 @@ cifs_parse_devname(const char *devname, struct smb_vol *vol)
convert_delimiter(vol->UNC, '\\');
- /* If pos is NULL, or is a bogus trailing delimiter then no prepath */
- if (!*pos++ || !*pos)
+ /* skip any delimiter */
+ if (*pos == '/' || *pos == '\\')
+ pos++;
+
+ /* If pos is NULL then no prepath */
+ if (!*pos)
return 0;
vol->prepath = kstrdup(pos, GFP_KERNEL);
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread[parent not found: <1454919241-28048-1-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] cifs: remove any preceding delimiter from prefix_path [not found] ` <1454919241-28048-1-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2016-04-25 3:30 ` Steve French 0 siblings, 0 replies; 2+ messages in thread From: Steve French @ 2016-04-25 3:30 UTC (permalink / raw) To: Sachin Prabhu; +Cc: linux-cifs Merged into cifs-2.6.git On Mon, Feb 8, 2016 at 2:14 AM, Sachin Prabhu <sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote: > We currently do not check if any delimiter exists before the prefix > path in cifs_compose_mount_options(). Consequently when building the > devname using cifs_build_devname() we can end up with multiple > delimiters separating the UNC and the prefix path. > > An issue was reported by the customer mounting a folder within a DFS > share from a Netapp server which uses McAfee antivirus. We have > narrowed down the cause to the use of double backslashes in the file > name used to open the file. This was determined to be caused because of > additional delimiters as a result of the bug. > > In addition to changes in cifs_build_devname(), we also fix > cifs_parse_devname() to ignore any preceding delimiter for the prefix > path. > > The problem was originally reported on RHEL 6 in RHEL bz 1252721. This > is the upstream version of the fix. The fix was confirmed by looking at > the packet capture of a DFS mount. > > Signed-off-by: Sachin Prabhu <sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > --- > fs/cifs/cifs_dfs_ref.c | 6 +++++- > fs/cifs/connect.c | 8 ++++++-- > 2 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c > index 7dc886c..10db1fe 100644 > --- a/fs/cifs/cifs_dfs_ref.c > +++ b/fs/cifs/cifs_dfs_ref.c > @@ -151,8 +151,12 @@ char *cifs_compose_mount_options(const char *sb_mountdata, > if (sb_mountdata == NULL) > return ERR_PTR(-EINVAL); > > - if (strlen(fullpath) - ref->path_consumed) > + if (strlen(fullpath) - ref->path_consumed) { > prepath = fullpath + ref->path_consumed; > + /* skip initial delimiter */ > + if (*prepath == '/' || *prepath == '\\') > + prepath++; > + } > > *devname = cifs_build_devname(ref->node_name, prepath); > if (IS_ERR(*devname)) { > diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c > index 4fbd92d..2acb4bb 100644 > --- a/fs/cifs/connect.c > +++ b/fs/cifs/connect.c > @@ -1196,8 +1196,12 @@ cifs_parse_devname(const char *devname, struct smb_vol *vol) > > convert_delimiter(vol->UNC, '\\'); > > - /* If pos is NULL, or is a bogus trailing delimiter then no prepath */ > - if (!*pos++ || !*pos) > + /* skip any delimiter */ > + if (*pos == '/' || *pos == '\\') > + pos++; > + > + /* If pos is NULL then no prepath */ > + if (!*pos) > return 0; > > vol->prepath = kstrdup(pos, GFP_KERNEL); > -- > 2.5.0 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Thanks, Steve ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-25 3:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-08 8:14 [PATCH] cifs: remove any preceding delimiter from prefix_path Sachin Prabhu
[not found] ` <1454919241-28048-1-git-send-email-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-25 3:30 ` Steve French
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox