[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>

+4 -3
+4 -3
fs/cifs/connect.c
··· 2270 2270 cFYI(1, ("Found match on UNC path")); 2271 2271 /* existing tcon already has a reference */ 2272 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 2276 } else { 2274 2277 tcon = tconInfoAlloc(); 2275 2278 if (tcon == NULL) { 2276 2279 rc = -ENOMEM; 2277 2280 goto mount_fail_check; 2278 2281 } 2282 + tcon->ses = pSesInfo; 2279 2283 2280 2284 /* check for null share name ie connect to dfs root */ 2281 - 2282 - /* BB check if works for exactly length 3 strings */ 2283 2285 if ((strchr(volume_info.UNC + 3, '\\') == NULL) 2284 2286 && (strchr(volume_info.UNC + 3, '/') == NULL)) { 2285 2287 /* rc = connect_to_dfs_path(...) */ ··· 2304 2302 if (rc) 2305 2303 goto mount_fail_check; 2306 2304 tcon->seal = volume_info.seal; 2307 - tcon->ses = pSesInfo; 2308 2305 write_lock(&cifs_tcp_ses_lock); 2309 2306 list_add(&tcon->tcon_list, &pSesInfo->tcon_list); 2310 2307 write_unlock(&cifs_tcp_ses_lock);