Commit 7d161b7f authored by Jeff Layton's avatar Jeff Layton Committed by Steve French

cifs: allow calling cifs_build_path_to_root on incomplete cifs_sb

It's possible that cifs_mount will call cifs_build_path_to_root on a
newly instantiated cifs_sb. In that case, it's likely that the
master_tlink pointer has not yet been instantiated.

Fix this by having cifs_build_path_to_root take a cifsTconInfo pointer
as well, and have the caller pass that in.
Reported-and-Tested-by: default avatarRobbert Kouprie <robbert@exx.nl>
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 03ceace5
...@@ -54,7 +54,8 @@ do { \ ...@@ -54,7 +54,8 @@ do { \
__func__, curr_xid, (int)rc); \ __func__, curr_xid, (int)rc); \
} while (0) } while (0)
extern char *build_path_from_dentry(struct dentry *); extern char *build_path_from_dentry(struct dentry *);
extern char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb); extern char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb,
struct cifsTconInfo *tcon);
extern char *build_wildcard_path_from_dentry(struct dentry *direntry); extern char *build_wildcard_path_from_dentry(struct dentry *direntry);
extern char *cifs_compose_mount_options(const char *sb_mountdata, extern char *cifs_compose_mount_options(const char *sb_mountdata,
const char *fullpath, const struct dfs_info3_param *ref, const char *fullpath, const struct dfs_info3_param *ref,
......
...@@ -2833,7 +2833,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, ...@@ -2833,7 +2833,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
/* check if a whole path (including prepath) is not remote */ /* check if a whole path (including prepath) is not remote */
if (!rc && cifs_sb->prepathlen && tcon) { if (!rc && cifs_sb->prepathlen && tcon) {
/* build_path_to_root works only when we have a valid tcon */ /* build_path_to_root works only when we have a valid tcon */
full_path = cifs_build_path_to_root(cifs_sb); full_path = cifs_build_path_to_root(cifs_sb, tcon);
if (full_path == NULL) { if (full_path == NULL) {
rc = -ENOMEM; rc = -ENOMEM;
goto mount_fail_check; goto mount_fail_check;
......
...@@ -728,12 +728,12 @@ static const struct inode_operations cifs_ipc_inode_ops = { ...@@ -728,12 +728,12 @@ static const struct inode_operations cifs_ipc_inode_ops = {
.lookup = cifs_lookup, .lookup = cifs_lookup,
}; };
char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb) char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb,
struct cifsTconInfo *tcon)
{ {
int pplen = cifs_sb->prepathlen; int pplen = cifs_sb->prepathlen;
int dfsplen; int dfsplen;
char *full_path = NULL; char *full_path = NULL;
struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb);
/* if no prefix path, simply set path to the root of share to "" */ /* if no prefix path, simply set path to the root of share to "" */
if (pplen == 0) { if (pplen == 0) {
...@@ -875,7 +875,7 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) ...@@ -875,7 +875,7 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino)
char *full_path; char *full_path;
struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb); struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb);
full_path = cifs_build_path_to_root(cifs_sb); full_path = cifs_build_path_to_root(cifs_sb, tcon);
if (full_path == NULL) if (full_path == NULL)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment