diff options
| author | Shyam Prasad N <sprasad@microsoft.com> | 2022-06-06 09:52:46 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-06-14 18:41:45 +0200 |
| commit | 46d520e6a30ef7f5242579fef31f1fd9fa55b95f (patch) | |
| tree | 40fe4964616a52e1d47b1bb57fa1eaefc806b7bf | |
| parent | 2194646e41848c4edc80464adbc77b84db3d0f0c (diff) | |
| download | linux-46d520e6a30ef7f5242579fef31f1fd9fa55b95f.tar.gz linux-46d520e6a30ef7f5242579fef31f1fd9fa55b95f.zip | |
cifs: populate empty hostnames for extra channels
commit 4c14d7043fede258957d7b01da0cad2d9fe3a205 upstream.
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: 5112d80c162f ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | fs/cifs/connect.c | 4 | ||||
| -rw-r--r-- | fs/cifs/sess.c | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index faf4587804d9..9dc0c7ccd5e8 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -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); diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 1a0995bb5d90..822da5689166 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -274,7 +274,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; |
