]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
smb: client: fix cifs_pick_channel when channel needs reconnect
authorHenrique Carvalho <henrique.carvalho@suse.com>
Fri, 7 Nov 2025 21:59:53 +0000 (18:59 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Nov 2025 09:37:46 +0000 (10:37 +0100)
commit 79280191c2fd7f24899bbd640003b5389d3c109c upstream.

cifs_pick_channel iterates candidate channels using cur. The
reconnect-state test mistakenly used a different variable.

This checked the wrong slot and would cause us to skip a healthy channel
and to dispatch on one that needs reconnect, occasionally failing
operations when a channel was down.

Fix by replacing for the correct variable.

Fixes: fc43a8ac396d ("cifs: cifs_pick_channel should try selecting active channels")
Cc: stable@vger.kernel.org
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/smb/client/transport.c

index 940e901071343d0aba219d11571b94ef648fe5fa..dc5cdbebe2bd700a5c4ae3e44b922104b9130dbf 100644 (file)
@@ -831,7 +831,7 @@ struct TCP_Server_Info *cifs_pick_channel(struct cifs_ses *ses)
                if (!server || server->terminate)
                        continue;
 
-               if (CIFS_CHAN_NEEDS_RECONNECT(ses, i))
+               if (CIFS_CHAN_NEEDS_RECONNECT(ses, cur))
                        continue;
 
                /*