FAILED: patch "[PATCH] smb: client: cancel reconnect work in" failed to apply to 6.1-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.1-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-6.1.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 '2026092259-extortion-dragging-26e2@gregkh' --subject-prefix 'PATCH 6.1.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 6.1: keep the string-returning DNS resolver API, the cifs_convert_address() call under srv_lock, and the existing return-value convention. Pass NULL for the unused expiry and remove all periodic DNS work state, scheduling, and cancellation.
Drop the sess.c hunk: channel error cleanup already calls cifs_put_tcp_session(), which handles delayed work and reference counts. Removing the resolve cancellation from clean_demultiplex_info() also allows c65eae6f61d1778ff7a82e4aae4080e26f486af1 to apply unchanged.
[ sashal: Reduced backport -- upstream 0e9bd27b2a635 touches 3 file(s), this
backport carries 2. Not backported here:
fs/cifs/cifsglob.h
fs/cifs/connect.c
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/smb/client/cifsglob.h | 5 ---- fs/smb/client/connect.c | 53 +++------------------------------------- 2 files changed, 3 insertions(+), 55 deletions(-)
fs/smb/client/cifsglob.h +0 -5
@@ -80,10 +80,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 -/* smb multichannel query server interfaces interval in seconds */ #define SMB_INTERFACE_POLL_INTERVAL 600
@@ -671,7 +667,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/smb/client/connect.c +3 -50
106 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/smb/client/connect.c | 1 + 1 file changed, 1 insertion(+)
fs/smb/client/connect.c +1 -0
@@ -970,6 +970,7 @@ static void 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;
Signature · 1 line
2.53.0