Skip to content

Commit fe75ac0

Browse files
Paulo Alcantaravijay-suman
authored andcommitted
smb: client: fix potential UAF in cifs_dump_full_key()
commit 58acd1f upstream. Skip sessions that are being teared down (status == SES_EXITING) to avoid UAF. Cc: [email protected] Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]> Signed-off-by: Steve French <[email protected]> [ This patch removes lock/unlock operation in routine cifs_dump_full_key() for ses_lock is not present in v5.15 and not ported yet. ses->status is protected by a global lock, cifs_tcp_ses_lock, in v5.15. ] Signed-off-by: Jianqi Ren <[email protected]> Signed-off-by: He Zhe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit d798fd98e3563027c5162259ead517057d6fa794) Signed-off-by: Vijayendra Suman <[email protected]>
1 parent 5568c6c commit fe75ac0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/cifs/ioctl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ static int cifs_dump_full_key(struct cifs_tcon *tcon, struct smb3_full_key_debug
232232
spin_lock(&cifs_tcp_ses_lock);
233233
list_for_each_entry(server_it, &cifs_tcp_ses_list, tcp_ses_list) {
234234
list_for_each_entry(ses_it, &server_it->smb_ses_list, smb_ses_list) {
235-
if (ses_it->Suid == out.session_id) {
235+
if (ses_it->status != CifsExiting &&
236+
ses_it->Suid == out.session_id) {
236237
ses = ses_it;
237238
/*
238239
* since we are using the session outside the crit

0 commit comments

Comments
 (0)