FAILED: patch "[PATCH] smb: client: cancel reconnect work in" failed to apply to 5.15-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x c65eae6f61d1778ff7a82e4aae4080e26f486af1
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026092200-operating-swinger-d7a7@gregkh' --subject-prefix 'PATCH 5.15.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From c65eae6f61d1778ff7a82e4aae4080e26f486af1 Mon Sep 17 00:00:00 2001
From: Paulo Alcantara <[email protected]>
Date: Fri, 11 Sep 2026 22:38:04 -0300
Subject: [PATCH] smb: client: cancel reconnect work in
clean_demultiplex_info()
clean_demultiplex_info() cancels server->echo delayed work but not server->reconnect, which can cause a use-after-free when the demultiplex thread exits while a reconnect work is still queued:
cifs_demultiplex_thread()
cifs_readv_from_socket()
cifs_reconnect()
__cifs_reconnect()
cifs_queue_server_reconn()
mod_delayed_work(cifsiod_wq, &server->reconnect, 0)
clean_demultiplex_info()
cancel_delayed_work_sync(&server->echo) // echo canceled
// reconnect NOT canceled
kfree_sensitive(server) // server freed ...later, on cifsiod_wq:
smb2_reconnect_server()
server->srv_count // UAF read of freed server
Fix this by canceling server->reconnect delayed work in clean_demultiplex_info() before the server is freed, the same way cifs_put_tcp_session() already does.
fs/smb/client/connect.c +1 -0
@@ -1067,6 +1067,7 @@ clean_demultiplex_info(struct TCP_Server_Info *server)spin_unlock (&server->srv_lock);cancel_delayed_work_sync (&server->echo); +cancel_delayed_work_sync (&server->reconnect);spin_lock (&server->srv_lock); server->tcpStatus = CifsExiting;
Sasha Levin
maintainerPATCH 1/2 cifs: get rid of dns resolve worker
From: Paulo Alcantara <[email protected]>
[ Upstream commit 0e9bd27b2a635d54665fcc1d6398a5f6aeb6b0cb ]
We already upcall to resolve hostnames during reconnect by calling reconn_set_ipaddr_from_hostname(), so there is no point in having a worker to periodically call it.
Reviewed-by <[email protected]>
Backport to 5.15: keep the existing string-returning DNS resolver, address conversion, and cifs_tcp_ses_lock protection. Remove the DNS worker, its scheduling and cancellation, and its interval constants. Drop the sess.c hunk because this tree has no explicit DNS-work cancellation in cifs_ses_add_channel(); it uses cifs_put_tcp_session(). Do not import the newer interface-polling or reconnect helpers.
This leaves clean_demultiplex_info() ready for the reconnect-work cancellation in c65eae6f61d1778ff7a82e4aae4080e26f486af1.
[ sashal: Reduced backport -- upstream 0e9bd27b2a635 touches 3 file(s), this
backport carries 2. Not backported here:
fs/cifs/sess.c
This note is generated from the file lists only; see the resolution record for the reasoning. ]
Stable-dep-of: c65eae6f61d1 ("smb: client: cancel reconnect work in clean_demultiplex_info()")
--- fs/cifs/cifsglob.h | 5 ----- fs/cifs/connect.c | 54 +++------------------------------------------- 2 files changed, 3 insertions(+), 56 deletions(-)
fs/cifs/cifsglob.h +0 -5
@@ -78,10 +78,6 @@#define SMB_ECHO_INTERVAL_MAX 600#define SMB_ECHO_INTERVAL_DEFAULT 60 -/* dns resolution intervals in seconds */ -#define SMB_DNS_RESOLVE_INTERVAL_MIN 120 -#define SMB_DNS_RESOLVE_INTERVAL_DEFAULT 600 -/* maximum number of PDUs in one compound */ #define MAX_COMPOUND 5
@@ -651,7 +647,6 @@ struct TCP_Server_Info {/* point to the SMBD connection if RDMA is used instead of socket */ struct smbd_connection *smbd_conn;struct delayed_work echo;/* echo ping workqueue job */ -struct delayed_work resolve;/* dns resolution workqueue job */ char *smallbuf;/* pointer to current "small" buffer */ char *bigbuf;/* pointer to current "big" buffer */ /* Total size of this PDU. Only valid from cifs_demultiplex_thread */
fs/cifs/connect.c +3 -51
101 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 smb: client: cancel reconnect work in clean_demultiplex_info()
From: Paulo Alcantara <[email protected]>
[ Upstream commit c65eae6f61d1778ff7a82e4aae4080e26f486af1 ]
clean_demultiplex_info() cancels server->echo delayed work but not server->reconnect, which can cause a use-after-free when the demultiplex thread exits while a reconnect work is still queued:
cifs_demultiplex_thread()
cifs_readv_from_socket()
cifs_reconnect()
__cifs_reconnect()
cifs_queue_server_reconn()
mod_delayed_work(cifsiod_wq, &server->reconnect, 0)
clean_demultiplex_info()
cancel_delayed_work_sync(&server->echo) // echo canceled
// reconnect NOT canceled
kfree_sensitive(server) // server freed ...later, on cifsiod_wq:
smb2_reconnect_server()
server->srv_count // UAF read of freed server
Fix this by canceling server->reconnect delayed work in clean_demultiplex_info() before the server is freed, the same way cifs_put_tcp_session() already does.
--- fs/cifs/connect.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/connect.c +1 -0
@@ -725,6 +725,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)spin_unlock (&cifs_tcp_ses_lock);cancel_delayed_work_sync (&server->echo); +cancel_delayed_work_sync (&server->reconnect);spin_lock (&GlobalMid_Lock); server->tcpStatus = CifsExiting;
Signature · 1 line
2.53.0