From: Chanho Min <chanho.min@lge.com>
To: Steve French <sfrench@samba.org>, linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org, linux-kernel@vger.kernel.org,
gunho.lee@lge.com, gregkh@linuxfoundation.org, sashal@kernel.org,
Paulo Alcantara <pc@manguebit.com>,
stable@vger.kernel.org, Steve French <stfrench@microsoft.com>,
Jianqi Ren <jianqi.ren.cn@windriver.com>,
He Zhe <zhe.he@windriver.com>, Chanho Min <chanho.min@lge.com>
Subject: [PATCH 1/4] smb: client: fix potential UAF in cifs_debug_files_proc_show()
Date: Mon, 11 Aug 2025 18:46:36 +0900 [thread overview]
Message-ID: <20250811094639.37446-2-chanho.min@lge.com> (raw)
In-Reply-To: <20250811094639.37446-1-chanho.min@lge.com>
From: Paulo Alcantara <pc@manguebit.com>
commit ca545b7f0823f19db0f1148d59bc5e1a56634502 upstream.
Skip sessions that are being teared down (status == SES_EXITING) to
avoid UAF.
Cc: stable@vger.kernel.org # 5.4
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
[ This patch removes lock/unlock operation in routine cifs_ses_exiting()
for ses_lock is not present in v5.10 and not ported yet. ses->status
is protected by a global lock, cifs_tcp_ses_lock, in v5.10. ]
Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
Signed-off-by: He Zhe <zhe.he@windriver.com>
[ chanho: Backport to v5.4.y from v5.10.y's commit 8f8718afd44 ]
Signed-off-by: Chanho Min <chanho.min@lge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/cifs/cifs_debug.c | 2 ++
fs/cifs/cifsglob.h | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index efb2928ff6c89..df3dfa611c352 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -162,6 +162,8 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
tcp_ses_list);
list_for_each(tmp, &server->smb_ses_list) {
ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
+ if (cifs_ses_exiting(ses))
+ continue;
list_for_each(tmp1, &ses->tcon_list) {
tcon = list_entry(tmp1, struct cifs_tcon, tcon_list);
spin_lock(&tcon->open_file_lock);
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 253321adc2664..5f545a240afa6 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -2027,4 +2027,12 @@ static inline struct scatterlist *cifs_sg_set_buf(struct scatterlist *sg,
return sg;
}
+static inline bool cifs_ses_exiting(struct cifs_ses *ses)
+{
+ bool ret;
+
+ ret = ses->status == CifsExiting;
+ return ret;
+}
+
#endif /* _CIFS_GLOB_H */
next prev parent reply other threads:[~2025-08-11 10:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 9:46 [PATCH 0/4] smb: Backport UAF fixes for v5.4.y Chanho Min
2025-08-11 9:46 ` Chanho Min [this message]
2025-08-11 9:46 ` [PATCH 2/4] smb: client: fix potential UAF in is_valid_oplock_break() Chanho Min
2025-08-11 9:46 ` [PATCH 3/4] smb: client: fix potential UAF in smb2_is_valid_lease_break() Chanho Min
2025-08-11 9:46 ` [PATCH 4/4] smb: client: fix potential UAF in cifs_stats_proc_write() Chanho Min
2025-08-24 8:47 ` [PATCH 0/4] smb: Backport UAF fixes for v5.4.y Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250811094639.37446-2-chanho.min@lge.com \
--to=chanho.min@lge.com \
--cc=gregkh@linuxfoundation.org \
--cc=gunho.lee@lge.com \
--cc=jianqi.ren.cn@windriver.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pc@manguebit.com \
--cc=samba-technical@lists.samba.org \
--cc=sashal@kernel.org \
--cc=sfrench@samba.org \
--cc=stable@vger.kernel.org \
--cc=stfrench@microsoft.com \
--cc=zhe.he@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox