aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2009-07-23 15:22:30 -0400
committerSteve French <sfrench@us.ibm.com>2009-07-27 20:51:59 -0400
commit7b91e2661addd8e2419cb45f6a322aa5dab9bcee (patch)
treecf17b0ca2bffa52c7e450cd75d5277c35cc9eda4 /fs/cifs/connect.c
parentfc013a58859b7cf85e53a05804a74952fe0a4117 (diff)
cifs: fix error handling in mount-time DFS referral chasing code
If the referral is malformed or the hostname can't be resolved, then the current code generates an oops. Fix it to handle these errors gracefully. Reported-by: Sandro Mathys <sm@sandro-mathys.ch> Acked-by: Igor Mammedov <niallain@gmail.com> CC: Stable <stable@kernel.org> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index fc44d316d0bb..f2486889b7bb 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2544,11 +2544,20 @@ remote_path_check:
2544 2544
2545 if (mount_data != mount_data_global) 2545 if (mount_data != mount_data_global)
2546 kfree(mount_data); 2546 kfree(mount_data);
2547
2547 mount_data = cifs_compose_mount_options( 2548 mount_data = cifs_compose_mount_options(
2548 cifs_sb->mountdata, full_path + 1, 2549 cifs_sb->mountdata, full_path + 1,
2549 referrals, &fake_devname); 2550 referrals, &fake_devname);
2550 kfree(fake_devname); 2551
2551 free_dfs_info_array(referrals, num_referrals); 2552 free_dfs_info_array(referrals, num_referrals);
2553 kfree(fake_devname);
2554 kfree(full_path);
2555
2556 if (IS_ERR(mount_data)) {
2557 rc = PTR_ERR(mount_data);
2558 mount_data = NULL;
2559 goto mount_fail_check;
2560 }
2552 2561
2553 if (tcon) 2562 if (tcon)
2554 cifs_put_tcon(tcon); 2563 cifs_put_tcon(tcon);
@@ -2556,8 +2565,6 @@ remote_path_check:
2556 cifs_put_smb_ses(pSesInfo); 2565 cifs_put_smb_ses(pSesInfo);
2557 2566
2558 cleanup_volume_info(&volume_info); 2567 cleanup_volume_info(&volume_info);
2559 FreeXid(xid);
2560 kfree(full_path);
2561 referral_walks_count++; 2568 referral_walks_count++;
2562 goto try_mount_again; 2569 goto try_mount_again;
2563 } 2570 }