[SRU][F][PATCH v2 2/2] smb: client: fix potential UAF in smb2_is_valid_lease_break()

Yuxuan Luo yuxuan.luo at canonical.com
Wed Feb 12 02:12:32 UTC 2025


From: Paulo Alcantara <pc at manguebit.com>

Skip sessions that are being teared down (status == SES_EXITING) to
avoid UAF.

Cc: stable at vger.kernel.org
Signed-off-by: Paulo Alcantara (Red Hat) <pc at manguebit.com>
Signed-off-by: Steve French <stfrench at microsoft.com>
(backported from commit 705c76fbf726c7a2f6ff9143d4013b18daaaebf1)
[yuxuan.luo: ignored context conflicts and added the if statement.]
CVE-2024-35864
Signed-off-by: Yuxuan Luo <yuxuan.luo at canonical.com>
---
 fs/cifs/smb2misc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index d3d5d2c6c401..96c104e399ee 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -611,6 +611,8 @@ smb2_is_valid_lease_break(char *buffer)
 
 		list_for_each(tmp1, &server->smb_ses_list) {
 			ses = list_entry(tmp1, struct cifs_ses, smb_ses_list);
+			if (cifs_ses_exiting(ses))
+				continue;
 
 			list_for_each(tmp2, &ses->tcon_list) {
 				tcon = list_entry(tmp2, struct cifs_tcon,
-- 
2.43.0




More information about the kernel-team mailing list