summaryrefslogtreecommitdiffstats
path: root/fs/smb
diff options
context:
space:
mode:
authorPaulo Alcantara <pc@manguebit.com>2024-04-02 21:34:00 +0200
committerSteve French <stfrench@microsoft.com>2024-04-03 21:44:42 +0200
commit69ccf040acddf33a3a85ec0f6b45ef84b0f7ec29 (patch)
tree91d9f4d74b7601415c3a82fe7a6081fcad0cbd05 /fs/smb
parentsmb: client: fix potential UAF in smb2_is_valid_oplock_break() (diff)
downloadlinux-69ccf040acddf33a3a85ec0f6b45ef84b0f7ec29.tar.xz
linux-69ccf040acddf33a3a85ec0f6b45ef84b0f7ec29.zip
smb: client: fix potential UAF in is_valid_oplock_break()
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')
-rw-r--r--fs/smb/client/misc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/smb/client/misc.c b/fs/smb/client/misc.c
index 1ea22b3955a2..33ac4f8f5050 100644
--- a/fs/smb/client/misc.c
+++ b/fs/smb/client/misc.c
@@ -481,6 +481,8 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv)
/* look up tcon based on tid & uid */
spin_lock(&cifs_tcp_ses_lock);
list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
+ if (cifs_ses_exiting(ses))
+ continue;
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
if (tcon->tid != buf->Tid)
continue;