mirror of https://gitee.com/openkylin/linux.git
CIFS: Fix ERR_PTR dereference in cifs_get_root
move it to the beginning of the loop. Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
parent
9438fabb73
commit
5b980b0121
|
@ -548,6 +548,12 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
|
||||||
struct inode *dir = dentry->d_inode;
|
struct inode *dir = dentry->d_inode;
|
||||||
struct dentry *child;
|
struct dentry *child;
|
||||||
|
|
||||||
|
if (!dir) {
|
||||||
|
dput(dentry);
|
||||||
|
dentry = ERR_PTR(-ENOENT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* skip separators */
|
/* skip separators */
|
||||||
while (*s == sep)
|
while (*s == sep)
|
||||||
s++;
|
s++;
|
||||||
|
@ -563,10 +569,6 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
|
||||||
mutex_unlock(&dir->i_mutex);
|
mutex_unlock(&dir->i_mutex);
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
dentry = child;
|
dentry = child;
|
||||||
if (!dentry->d_inode) {
|
|
||||||
dput(dentry);
|
|
||||||
dentry = ERR_PTR(-ENOENT);
|
|
||||||
}
|
|
||||||
} while (!IS_ERR(dentry));
|
} while (!IS_ERR(dentry));
|
||||||
_FreeXid(xid);
|
_FreeXid(xid);
|
||||||
kfree(full_path);
|
kfree(full_path);
|
||||||
|
|
Loading…
Reference in New Issue