cifs: allow calling cifs_build_path_to_root on incomplete cifs_sb
Subsystems (2)
PATCH 1/1 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.
--- fs/cifs/cifsproto.h | 3 ++- fs/cifs/connect.c | 2 +- fs/cifs/inode.c | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-)
fs/cifs/cifsproto.h +2 -1
@@ -54,7 +54,8 @@ do { \ __func__, curr_xid, (int)rc); \ }while (0 ) 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 *cifs_compose_mount_options(const char *sb_mountdata, const char *fullpath, const struct dfs_info3_param *ref,
fs/cifs/connect.c +1 -1
@@ -2833,7 +2833,7 @@ remote_path_check:/* check if a whole path (including prepath) is not remote */ if (!rc && cifs_sb->prepathlen && 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 ) { rc = -ENOMEM ; goto mount_fail_check;
fs/cifs/inode.c +3 -3
@@ -728,12 +728,12 @@ static const struct inode_operations cifs_ipc_inode_ops = { .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 dfsplen;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 (pplen ==0 ) {
@@ -875,7 +875,7 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino)char *full_path;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 )return ERR_PTR (-ENOMEM );
Signature · 1 line
1.7.3.2
A message that is not in the archive (sent off-list or not yet received): 1291687653-23824-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
PATCH 1/1 cifs: fix check of error return from is_path_accessable
This function will return 0 if everything went ok. Commit 9d002df4 however added a block of code after the following check for rc == -EREMOTE. With that change and when rc == 0, doing the "goto mount_fail_check" here skips that code, leaving the tlink_tree and master_tlink pointer unpopulated. That causes an oops later in cifs_root_iget.
--- fs/cifs/connect.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/cifs/connect.c +1 -1
@@ -2839,7 +2839,7 @@ remote_path_check: goto mount_fail_check; } rc =is_path_accessible (xid, tcon, cifs_sb, full_path); -if (rc != -EREMOTE ) { +if (rc !=0 && rc != -EREMOTE ) {kfree (full_path); goto mount_fail_check; }
Signature · 1 line
1.7.3.2