mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
cifs: refcount only the selected iface during interface update
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: b54034a73b
("cifs: during reconnect, update interface if necessary")
Cc: stable@vger.kernel.org # 5.19+
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
39a154fc2d
commit
7246210ecd
@ -292,9 +292,10 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
|
||||
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");
|
||||
|
Loading…
Reference in New Issue
Block a user