1 From 69ccf040acddf33a3a85ec0f6b45ef84b0f7ec29 Mon Sep 17 00:00:00 2001
2 From: Paulo Alcantara <pc@manguebit.com>
3 Date: Tue, 2 Apr 2024 16:34:00 -0300
4 Subject: smb: client: fix potential UAF in is_valid_oplock_break()
6 From: Paulo Alcantara <pc@manguebit.com>
8 commit 69ccf040acddf33a3a85ec0f6b45ef84b0f7ec29 upstream.
10 Skip sessions that are being teared down (status == SES_EXITING) to
13 Cc: stable@vger.kernel.org
14 Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
15 Signed-off-by: Steve French <stfrench@microsoft.com>
16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18 fs/smb/client/misc.c | 2 ++
19 1 file changed, 2 insertions(+)
21 --- a/fs/smb/client/misc.c
22 +++ b/fs/smb/client/misc.c
23 @@ -489,6 +489,8 @@ is_valid_oplock_break(char *buffer, stru
24 /* look up tcon based on tid & uid */
25 spin_lock(&cifs_tcp_ses_lock);
26 list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
27 + if (cifs_ses_exiting(ses))
29 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
30 if (tcon->tid != buf->Tid)