diff options
author | Paulo Alcantara <pc@manguebit.com> | 2024-04-02 22:33:53 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2024-04-03 22:43:34 +0300 |
commit | ca545b7f0823f19db0f1148d59bc5e1a56634502 (patch) | |
tree | 084dc86ae37199f48f5652ca7bc7900ef6af62e6 /fs/smb/client/cifsglob.h | |
parent | 173217bd73365867378b5e75a86f0049e1069ee8 (diff) | |
download | linux-ca545b7f0823f19db0f1148d59bc5e1a56634502.tar.xz |
smb: client: fix potential UAF in cifs_debug_files_proc_show()
Skip sessions that are being teared down (status == SES_EXITING) to
avoid UAF.
Cc: stable@vger.kernel.org
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb/client/cifsglob.h')
-rw-r--r-- | fs/smb/client/cifsglob.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h index 77ca7861a2cc..f6a302205f89 100644 --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -2325,4 +2325,14 @@ struct smb2_compound_vars { struct kvec ea_iov; }; +static inline bool cifs_ses_exiting(struct cifs_ses *ses) +{ + bool ret; + + spin_lock(&ses->ses_lock); + ret = ses->ses_status == SES_EXITING; + spin_unlock(&ses->ses_lock); + return ret; +} + #endif /* _CIFS_GLOB_H */ |