Skip to content

Commit 4c14d70

Browse files
sprasad-microsoftSteve French
authored andcommitted
cifs: populate empty hostnames for extra channels
Currently, the secondary channels of a multichannel session also get hostname populated based on the info in primary channel. However, this will end up with a wrong resolution of hostname to IP address during reconnect. This change fixes this by not populating hostname info for all secondary channels. Fixes: 5112d80 ("cifs: populate server_hostname for extra channels") Cc: [email protected] Signed-off-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 8ea2182 commit 4c14d70

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

fs/cifs/connect.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server)
9797
if (!server->hostname)
9898
return -EINVAL;
9999

100+
/* if server hostname isn't populated, there's nothing to do here */
101+
if (server->hostname[0] == '\0')
102+
return 0;
103+
100104
len = strlen(server->hostname) + 3;
101105

102106
unc = kmalloc(len, GFP_KERNEL);

fs/cifs/sess.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,10 @@ cifs_ses_add_channel(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses,
301301
/* Auth */
302302
ctx.domainauto = ses->domainAuto;
303303
ctx.domainname = ses->domainName;
304-
ctx.server_hostname = ses->server->hostname;
304+
305+
/* no hostname for extra channels */
306+
ctx.server_hostname = "";
307+
305308
ctx.username = ses->user_name;
306309
ctx.password = ses->password;
307310
ctx.sectype = ses->sectype;

0 commit comments

Comments
 (0)