Skip to content

Commit

Permalink
cifs: fix leak of iface for primary channel
Browse files Browse the repository at this point in the history
[ Upstream commit 29954d5 ]

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: fa1d050 ("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>
  • Loading branch information
sprasad-microsoft authored and gregkh committed Dec 3, 2023
1 parent d0b5a68 commit 4875ef3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/smb/client/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 4875ef3

Please sign in to comment.