]> git.itanic.dy.fi Git - linux-stable/commitdiff
cifs: use DFS root session instead of tcon ses
authorPaulo Alcantara <pc@manguebit.com>
Tue, 14 Mar 2023 23:32:56 +0000 (20:32 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Mar 2023 12:38:02 +0000 (13:38 +0100)
commit 6284e46bdd47743a064fe6ac834a7ac05b1fd206 upstream.

Use DFS root session whenever possible to get new DFS referrals
otherwise we might end up with an IPC tcon (tcon->ses->tcon_ipc) that
doesn't respond to them.  It should be safe accessing
@ses->dfs_root_ses directly in cifs_inval_name_dfs_link_error() as it
has same lifetime as of @tcon.

Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Cc: stable@vger.kernel.org # 6.2
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/misc.c

index 855cc523de25e28b898b9e0993b94128b4e06df8..9f4486b705d5c6cea4959a8c55cc1a1d955e182f 100644 (file)
@@ -1364,6 +1364,7 @@ int cifs_inval_name_dfs_link_error(const unsigned int xid,
                 * removing cached DFS targets that the client would eventually
                 * need during failover.
                 */
+               ses = CIFS_DFS_ROOT_SES(ses);
                if (ses->server->ops->get_dfs_refer &&
                    !ses->server->ops->get_dfs_refer(xid, ses, ref_path, &refs,
                                                     &num_refs, cifs_sb->local_nls,