summaryrefslogtreecommitdiff
path: root/fs/smb
diff options
context:
space:
mode:
authorShyam Prasad N <sprasad@microsoft.com>2023-11-14 07:54:12 +0300
committerSteve French <stfrench@microsoft.com>2023-11-14 20:38:00 +0300
commit29954d5b1e0d67a4cd61c30c2201030c97e94b1e (patch)
tree18dbe7c705e9b379a08dfa078295cd28a24df03e /fs/smb
parent181724fc72486dec2bec8803459be05b5162aaa8 (diff)
downloadlinux-29954d5b1e0d67a4cd61c30c2201030c97e94b1e.tar.xz
cifs: fix leak of iface for primary channel
My last change in this area introduced a change which accounted for primary channel in the interface ref count. However, it did not reduce this ref count on deallocation of the primary channel. i.e. during umount. Fixing this leak here, by dropping this ref count for primary channel while freeing up the session. Fixes: fa1d0508bdd4 ("cifs: account for primary channel in the interface list") Cc: stable@vger.kernel.org Reported-by: Paulo Alcantara <pc@manguebit.com> Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb')
-rw-r--r--fs/smb/client/connect.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 57c2a7df3457..f896f60c924b 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -2065,6 +2065,12 @@ void __cifs_put_smb_ses(struct cifs_ses *ses)
ses->chans[i].server = NULL;
}
+ /* we now account for primary channel in iface->refcount */
+ if (ses->chans[0].iface) {
+ kref_put(&ses->chans[0].iface->refcount, release_iface);
+ ses->chans[0].server = NULL;
+ }
+
sesInfoFree(ses);
cifs_put_tcp_session(server, 0);
}