diff options
author | Shyam Prasad N <sprasad@microsoft.com> | 2023-11-14 04:54:12 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-12-03 07:33:09 +0100 |
commit | 4875ef3e606bf66d1eba1509f7df08b87dda6843 (patch) | |
tree | 9ad8be0564e19527ebddfb7cbfd608318c666ac4 /fs | |
parent | d0b5a680a8ba155befd6df608cfc7bba594a8b81 (diff) | |
download | linux-stable-4875ef3e606bf66d1eba1509f7df08b87dda6843.tar.gz linux-stable-4875ef3e606bf66d1eba1509f7df08b87dda6843.tar.bz2 linux-stable-4875ef3e606bf66d1eba1509f7df08b87dda6843.zip |
cifs: fix leak of iface for primary channel
[ Upstream commit 29954d5b1e0d67a4cd61c30c2201030c97e94b1e ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/smb/client/connect.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index a9632c060bce..d517651d7bce 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -2034,6 +2034,12 @@ void __cifs_put_smb_ses(struct cifs_ses *ses) } } + /* 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); } |