提交 5b980b01 编写于 作者: P Pavel Shilovsky 提交者: Steve French

CIFS: Fix ERR_PTR dereference in cifs_get_root

move it to the beginning of the loop.
Signed-off-by: NPavel Shilovsky <piastryyy@gmail.com>
Reviewed-by: NJeff Layton <jlayton@redhat.com>
Signed-off-by: NSteve French <sfrench@us.ibm.com>
上级 9438fabb
......@@ -548,6 +548,12 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
struct inode *dir = dentry->d_inode;
struct dentry *child;
if (!dir) {
dput(dentry);
dentry = ERR_PTR(-ENOENT);
break;
}
/* skip separators */
while (*s == sep)
s++;
......@@ -563,10 +569,6 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
mutex_unlock(&dir->i_mutex);
dput(dentry);
dentry = child;
if (!dentry->d_inode) {
dput(dentry);
dentry = ERR_PTR(-ENOENT);
}
} while (!IS_ERR(dentry));
_FreeXid(xid);
kfree(full_path);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册