mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
smb: client: fix potential UAF in cifs_dump_full_key()
commit 58acd1f497162e7d282077f816faa519487be045 upstream. 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> Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com> Signed-off-by: He Zhe <zhe.he@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e0a545bb4a
commit
f4a60d360d
@@ -246,7 +246,9 @@ static int cifs_dump_full_key(struct cifs_tcon *tcon, struct smb3_full_key_debug
|
|||||||
spin_lock(&cifs_tcp_ses_lock);
|
spin_lock(&cifs_tcp_ses_lock);
|
||||||
list_for_each_entry(server_it, &cifs_tcp_ses_list, tcp_ses_list) {
|
list_for_each_entry(server_it, &cifs_tcp_ses_list, tcp_ses_list) {
|
||||||
list_for_each_entry(ses_it, &server_it->smb_ses_list, smb_ses_list) {
|
list_for_each_entry(ses_it, &server_it->smb_ses_list, smb_ses_list) {
|
||||||
if (ses_it->Suid == out.session_id) {
|
spin_lock(&ses_it->ses_lock);
|
||||||
|
if (ses_it->ses_status != SES_EXITING &&
|
||||||
|
ses_it->Suid == out.session_id) {
|
||||||
ses = ses_it;
|
ses = ses_it;
|
||||||
/*
|
/*
|
||||||
* since we are using the session outside the crit
|
* since we are using the session outside the crit
|
||||||
@@ -254,9 +256,11 @@ static int cifs_dump_full_key(struct cifs_tcon *tcon, struct smb3_full_key_debug
|
|||||||
* so increment its refcount
|
* so increment its refcount
|
||||||
*/
|
*/
|
||||||
ses->ses_count++;
|
ses->ses_count++;
|
||||||
|
spin_unlock(&ses_it->ses_lock);
|
||||||
found = true;
|
found = true;
|
||||||
goto search_end;
|
goto search_end;
|
||||||
}
|
}
|
||||||
|
spin_unlock(&ses_it->ses_lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
search_end:
|
search_end:
|
||||||
|
|||||||
Reference in New Issue
Block a user