]> git.baikalelectronics.ru Git - kernel.git/commitdiff
cifs: populate empty hostnames for extra channels
authorShyam Prasad N <sprasad@microsoft.com>
Mon, 6 Jun 2022 09:52:46 +0000 (09:52 +0000)
committerSteve French <stfrench@microsoft.com>
Fri, 10 Jun 2022 23:55:02 +0000 (18:55 -0500)
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: 41786c10bad5 ("cifs: populate server_hostname for extra channels")
Cc: stable@vger.kernel.org
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/connect.c
fs/cifs/sess.c

index d46702f5a6630cd102f0850359f828227c1c5191..1849e34114878b5acfe5dfabedd26de1e346e67c 100644 (file)
@@ -97,6 +97,10 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server)
        if (!server->hostname)
                return -EINVAL;
 
+       /* if server hostname isn't populated, there's nothing to do here */
+       if (server->hostname[0] == '\0')
+               return 0;
+
        len = strlen(server->hostname) + 3;
 
        unc = kmalloc(len, GFP_KERNEL);
index 3b7915af1f62e6150954d2ebba23c1033283e5b4..0bece97547d4b760138a22299feca6d8ebe6078c 100644 (file)
@@ -301,7 +301,10 @@ cifs_ses_add_channel(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses,
        /* Auth */
        ctx.domainauto = ses->domainAuto;
        ctx.domainname = ses->domainName;
-       ctx.server_hostname = ses->server->hostname;
+
+       /* no hostname for extra channels */
+       ctx.server_hostname = "";
+
        ctx.username = ses->user_name;
        ctx.password = ses->password;
        ctx.sectype = ses->sectype;