smb: client: fix missed ses refcounting
authorPaulo Alcantara <pc@manguebit.com>
Tue, 11 Jul 2023 17:15:10 +0000 (14:15 -0300)
committerSteve French <stfrench@microsoft.com>
Thu, 13 Jul 2023 04:29:39 +0000 (23:29 -0500)
commitbf99f6be2d20146942bce6f9e90a0ceef12cbc1e
treeb450eef72c474d156f50c778c2606034198694ac
parentf1f047bd7ce0d73788e04ac02268060a565f7ecb
smb: client: fix missed ses refcounting

Use new cifs_smb_ses_inc_refcount() helper to get an active reference
of @ses and @ses->dfs_root_ses (if set).  This will prevent
@ses->dfs_root_ses of being put in the next call to cifs_put_smb_ses()
and thus potentially causing an use-after-free bug.

Fixes: 8e3554150d6c ("cifs: fix sharing of DFS connections")
Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/dfs.c
fs/smb/client/smb2transport.c