This is a note to let you know that I've just added the patch titled smb: client: fix potential UAF in cifs_dump_full_key() to the 6.8-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: smb-client-fix-potential-uaf-in-cifs_dump_full_key.patch and it can be found in the queue-6.8 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 58acd1f497162e7d282077f816faa519487be045 Mon Sep 17 00:00:00 2001 From: Paulo Alcantara <pc@xxxxxxxxxxxxx> Date: Tue, 2 Apr 2024 16:33:54 -0300 Subject: smb: client: fix potential UAF in cifs_dump_full_key() From: Paulo Alcantara <pc@xxxxxxxxxxxxx> commit 58acd1f497162e7d282077f816faa519487be045 upstream. Skip sessions that are being teared down (status == SES_EXITING) to avoid UAF. Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Paulo Alcantara (Red Hat) <pc@xxxxxxxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/smb/client/ioctl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/fs/smb/client/ioctl.c +++ b/fs/smb/client/ioctl.c @@ -247,7 +247,9 @@ static int cifs_dump_full_key(struct cif spin_lock(&cifs_tcp_ses_lock); 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) { - 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; /* * since we are using the session outside the crit @@ -255,9 +257,11 @@ static int cifs_dump_full_key(struct cif * so increment its refcount */ cifs_smb_ses_inc_refcount(ses); + spin_unlock(&ses_it->ses_lock); found = true; goto search_end; } + spin_unlock(&ses_it->ses_lock); } } search_end: Patches currently in stable-queue which might be from pc@xxxxxxxxxxxxx are queue-6.8/smb-client-fix-potential-uaf-in-cifs_stats_proc_write.patch queue-6.8/smb-client-fix-potential-uaf-in-is_valid_oplock_break.patch queue-6.8/smb-client-guarantee-refcounted-children-from-parent-session.patch queue-6.8/smb-client-serialise-cifs_construct_tcon-with-cifs_mount_mutex.patch queue-6.8/smb-client-fix-potential-uaf-in-cifs_dump_full_key.patch queue-6.8/smb-client-refresh-referral-without-acquiring-refpath_lock.patch queue-6.8/smb-client-fix-potential-uaf-in-smb2_is_network_name_deleted.patch queue-6.8/smb-client-fix-potential-uaf-in-cifs_debug_files_proc_show.patch queue-6.8/smb-client-handle-dfs-tcons-in-cifs_construct_tcon.patch queue-6.8/smb-client-fix-uaf-in-smb2_reconnect_server.patch queue-6.8/smb-client-fix-potential-uaf-in-smb2_is_valid_lease_break.patch queue-6.8/smb-client-fix-potential-uaf-in-cifs_signal_cifsd_for_reconnect.patch queue-6.8/smb-client-fix-potential-uaf-in-cifs_stats_proc_show.patch queue-6.8/smb-client-fix-potential-uaf-in-smb2_is_valid_oplock_break.patch