This is a note to let you know that I've just added the patch titled cifs: refcount only the selected iface during interface update to the 6.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: cifs-refcount-only-the-selected-iface-during-interface-update.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 7246210ecdd0cda97fa3e3bb15c32c6c2d9a23b5 Mon Sep 17 00:00:00 2001 From: Shyam Prasad N <sprasad@xxxxxxxxxxxxx> Date: Tue, 27 Dec 2022 11:29:28 +0000 Subject: cifs: refcount only the selected iface during interface update From: Shyam Prasad N <sprasad@xxxxxxxxxxxxx> commit 7246210ecdd0cda97fa3e3bb15c32c6c2d9a23b5 upstream. When the server interface for a channel is not active anymore, we have the logic to select an alternative interface. However this was not breaking out of the loop as soon as a new alternative was found. As a result, some interfaces may get refcounted unintentionally. There was also a bug in checking if we found an alternate iface. Fixed that too. Fixes: b54034a73baf ("cifs: during reconnect, update interface if necessary") Cc: stable@xxxxxxxxxxxxxxx # 5.19+ Signed-off-by: Shyam Prasad N <sprasad@xxxxxxxxxxxxx> Reviewed-by: Paulo Alcantara (SUSE) <pc@xxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/cifs/sess.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -292,9 +292,10 @@ cifs_chan_update_iface(struct cifs_ses * continue; } kref_get(&iface->refcount); + break; } - if (!list_entry_is_head(iface, &ses->iface_list, iface_head)) { + if (list_entry_is_head(iface, &ses->iface_list, iface_head)) { rc = 1; iface = NULL; cifs_dbg(FYI, "unable to find a suitable iface\n"); Patches currently in stable-queue which might be from sprasad@xxxxxxxxxxxxx are queue-6.0/cifs-refcount-only-the-selected-iface-during-interface-update.patch queue-6.0/cifs-fix-interface-count-calculation-during-refresh.patch