mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
df070afd9b
commit
ce465bf94b
|
@ -4484,11 +4484,13 @@ cifs_are_all_path_components_accessible(struct TCP_Server_Info *server,
|
||||||
unsigned int xid,
|
unsigned int xid,
|
||||||
struct cifs_tcon *tcon,
|
struct cifs_tcon *tcon,
|
||||||
struct cifs_sb_info *cifs_sb,
|
struct cifs_sb_info *cifs_sb,
|
||||||
char *full_path)
|
char *full_path,
|
||||||
|
int added_treename)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
char *s;
|
char *s;
|
||||||
char sep, tmp;
|
char sep, tmp;
|
||||||
|
int skip = added_treename ? 1 : 0;
|
||||||
|
|
||||||
sep = CIFS_DIR_SEP(cifs_sb);
|
sep = CIFS_DIR_SEP(cifs_sb);
|
||||||
s = full_path;
|
s = full_path;
|
||||||
|
@ -4503,7 +4505,14 @@ cifs_are_all_path_components_accessible(struct TCP_Server_Info *server,
|
||||||
/* next separator */
|
/* next separator */
|
||||||
while (*s && *s != sep)
|
while (*s && *s != sep)
|
||||||
s++;
|
s++;
|
||||||
|
/*
|
||||||
|
* if the treename is added, we then have to skip the first
|
||||||
|
* part within the separators
|
||||||
|
*/
|
||||||
|
if (skip) {
|
||||||
|
skip = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* temporarily null-terminate the path at the end of
|
* temporarily null-terminate the path at the end of
|
||||||
* the current component
|
* the current component
|
||||||
|
@ -4551,8 +4560,7 @@ static int is_path_remote(struct cifs_sb_info *cifs_sb, struct smb_vol *vol,
|
||||||
|
|
||||||
if (rc != -EREMOTE) {
|
if (rc != -EREMOTE) {
|
||||||
rc = cifs_are_all_path_components_accessible(server, xid, tcon,
|
rc = cifs_are_all_path_components_accessible(server, xid, tcon,
|
||||||
cifs_sb,
|
cifs_sb, full_path, tcon->Flags & SMB_SHARE_IS_IN_DFS);
|
||||||
full_path);
|
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
cifs_dbg(VFS, "cannot query dirs between root and final path, "
|
cifs_dbg(VFS, "cannot query dirs between root and final path, "
|
||||||
"enabling CIFS_MOUNT_USE_PREFIX_PATH\n");
|
"enabling CIFS_MOUNT_USE_PREFIX_PATH\n");
|
||||||
|
|
Loading…
Reference in New Issue