aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2008-11-17 11:03:00 -0500
committerSteve French <sfrench@us.ibm.com>2008-11-17 11:03:00 -0500
commitab3f992983062440b4f37c666dac66d987902d91 (patch)
tree9333cd574f0a1ead688347b148ae36fdcd384440 /fs/cifs
parentc2b3382cd4d6c6adef1347e81f20e16c93a39feb (diff)
[CIFS] Fix check for tcon seal setting and fix oops on failed mount from earlier patch
set tcon->ses earlier If the inital tree connect fails, we'll end up calling cifs_put_smb_ses with a NULL pointer. Fix it by setting the tcon->ses earlier. Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/connect.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 2f2be8faabb3..c7d341714586 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2270,16 +2270,18 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2270 cFYI(1, ("Found match on UNC path")); 2270 cFYI(1, ("Found match on UNC path"));
2271 /* existing tcon already has a reference */ 2271 /* existing tcon already has a reference */
2272 cifs_put_smb_ses(pSesInfo); 2272 cifs_put_smb_ses(pSesInfo);
2273 if (tcon->seal != volume_info.seal)
2274 cERROR(1, ("transport encryption setting "
2275 "conflicts with existing tid"));
2273 } else { 2276 } else {
2274 tcon = tconInfoAlloc(); 2277 tcon = tconInfoAlloc();
2275 if (tcon == NULL) { 2278 if (tcon == NULL) {
2276 rc = -ENOMEM; 2279 rc = -ENOMEM;
2277 goto mount_fail_check; 2280 goto mount_fail_check;
2278 } 2281 }
2282 tcon->ses = pSesInfo;
2279 2283
2280 /* check for null share name ie connect to dfs root */ 2284 /* check for null share name ie connect to dfs root */
2281
2282 /* BB check if works for exactly length 3 strings */
2283 if ((strchr(volume_info.UNC + 3, '\\') == NULL) 2285 if ((strchr(volume_info.UNC + 3, '\\') == NULL)
2284 && (strchr(volume_info.UNC + 3, '/') == NULL)) { 2286 && (strchr(volume_info.UNC + 3, '/') == NULL)) {
2285 /* rc = connect_to_dfs_path(...) */ 2287 /* rc = connect_to_dfs_path(...) */
@@ -2302,7 +2304,6 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2302 if (rc) 2304 if (rc)
2303 goto mount_fail_check; 2305 goto mount_fail_check;
2304 tcon->seal = volume_info.seal; 2306 tcon->seal = volume_info.seal;
2305 tcon->ses = pSesInfo;
2306 write_lock(&cifs_tcp_ses_lock); 2307 write_lock(&cifs_tcp_ses_lock);
2307 list_add(&tcon->tcon_list, &pSesInfo->tcon_list); 2308 list_add(&tcon->tcon_list, &pSesInfo->tcon_list);
2308 write_unlock(&cifs_tcp_ses_lock); 2309 write_unlock(&cifs_tcp_ses_lock);