diff options
author | Ronnie Sahlberg <lsahlber@redhat.com> | 2019-07-10 23:46:58 -0400 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2019-07-13 13:09:29 -0400 |
commit | ce465bf94b70f03136171a62b607864f00093b19 (patch) | |
tree | d13cd85f4d2eb1920b86abd572dc6c25f3a265cc /fs/cifs | |
parent | df070afd9b8c952eacf49db54cae7138eb9deaeb (diff) |
cifs: fix crash in cifs_dfs_do_automount
RHBZ: 1649907
Fix a crash that happens while attempting to mount a DFS referral from the same server on the root of a filesystem.
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/connect.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 8ad8bbe8003b..6331c4f93b59 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -4484,11 +4484,13 @@ cifs_are_all_path_components_accessible(struct TCP_Server_Info *server, | |||
4484 | unsigned int xid, | 4484 | unsigned int xid, |
4485 | struct cifs_tcon *tcon, | 4485 | struct cifs_tcon *tcon, |
4486 | struct cifs_sb_info *cifs_sb, | 4486 | struct cifs_sb_info *cifs_sb, |
4487 | char *full_path) | 4487 | char *full_path, |
4488 | int added_treename) | ||
4488 | { | 4489 | { |
4489 | int rc; | 4490 | int rc; |
4490 | char *s; | 4491 | char *s; |
4491 | char sep, tmp; | 4492 | char sep, tmp; |
4493 | int skip = added_treename ? 1 : 0; | ||
4492 | 4494 | ||
4493 | sep = CIFS_DIR_SEP(cifs_sb); | 4495 | sep = CIFS_DIR_SEP(cifs_sb); |
4494 | s = full_path; | 4496 | s = full_path; |
@@ -4503,7 +4505,14 @@ cifs_are_all_path_components_accessible(struct TCP_Server_Info *server, | |||
4503 | /* next separator */ | 4505 | /* next separator */ |
4504 | while (*s && *s != sep) | 4506 | while (*s && *s != sep) |
4505 | s++; | 4507 | s++; |
4506 | 4508 | /* | |
4509 | * if the treename is added, we then have to skip the first | ||
4510 | * part within the separators | ||
4511 | */ | ||
4512 | if (skip) { | ||
4513 | skip = 0; | ||
4514 | continue; | ||
4515 | } | ||
4507 | /* | 4516 | /* |
4508 | * temporarily null-terminate the path at the end of | 4517 | * temporarily null-terminate the path at the end of |
4509 | * the current component | 4518 | * the current component |
@@ -4551,8 +4560,7 @@ static int is_path_remote(struct cifs_sb_info *cifs_sb, struct smb_vol *vol, | |||
4551 | 4560 | ||
4552 | if (rc != -EREMOTE) { | 4561 | if (rc != -EREMOTE) { |
4553 | rc = cifs_are_all_path_components_accessible(server, xid, tcon, | 4562 | rc = cifs_are_all_path_components_accessible(server, xid, tcon, |
4554 | cifs_sb, | 4563 | cifs_sb, full_path, tcon->Flags & SMB_SHARE_IS_IN_DFS); |
4555 | full_path); | ||
4556 | if (rc != 0) { | 4564 | if (rc != 0) { |
4557 | cifs_dbg(VFS, "cannot query dirs between root and final path, " | 4565 | cifs_dbg(VFS, "cannot query dirs between root and final path, " |
4558 | "enabling CIFS_MOUNT_USE_PREFIX_PATH\n"); | 4566 | "enabling CIFS_MOUNT_USE_PREFIX_PATH\n"); |