Skip to contentSkip to conversation

FAILED: patch "[PATCH] smb: client: fix smbd_connection leak on" failed to apply to 5.10-stable tree

PATCH New [email protected] 2 participants 2 messages Sep 22

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.10-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.10.y
git checkout FETCH_HEAD
git cherry-pick -x e75c96157d45e498970158c8f7373d90102e33b9
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026092222-drool-acetone-c3a8@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From e75c96157d45e498970158c8f7373d90102e33b9 Mon Sep 17 00:00:00 2001
From: Paulo Alcantara <[email protected]>
Date: Sat, 12 Sep 2026 14:20:08 -0300
Subject: [PATCH] smb: client: fix smbd_connection leak on
cifs_get_tcp_session() error

When an RDMA connection is successfully established via smbd_get_connection() but cifs_get_tcp_session() later fails (e.g. kthread_create() returns an error), the error path frees tcp_ses without first destroying the smbd_connection.

Fix this by calling smbd_destroy() in the out_err cleanup path before kfree(tcp_ses). smbd_destroy() safely handles the case where smbd_conn is NULL, so it can be called unconditionally.

Fixes 2f8946464b11 ("CIFS: SMBD: Upper layer connects to SMBDirect session")
Cc Tom Talpey <[email protected]>
Cc Stefan Metzmacher <[email protected]>
Cc Shyam Prasad N <[email protected]>
Cc Ronnie Sahlberg <[email protected]>
Cc Bharath SM <[email protected]>
Cc Namjae Jeon <[email protected]>
fs/smb/client/connect.c +1 -0
index 4bd9f9fb93bb..28e1ddeb6182 100644
@@ -1934,6 +1934,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,
 		kfree(tcp_ses->leaf_fullpath);
 		if (tcp_ses->ssocket)
 			sock_release(tcp_ses->ssocket);
+		smbd_destroy(tcp_ses);
 		kfree(tcp_ses);
 	}
 	return ERR_PTR(rc);
maintainer
#1 lore raw

PATCH 1/1 smb: client: fix smbd_connection leak on cifs_get_tcp_session() error

From: Paulo Alcantara <[email protected]>

[ Upstream commit e75c96157d45e498970158c8f7373d90102e33b9 ]

When an RDMA connection is successfully established via smbd_get_connection() but cifs_get_tcp_session() later fails (e.g. kthread_create() returns an error), the error path frees tcp_ses without first destroying the smbd_connection.

Fix this by calling smbd_destroy() in the out_err cleanup path before kfree(tcp_ses). smbd_destroy() safely handles the case where smbd_conn is NULL, so it can be called unconditionally.

Fixes 2f8946464b11 ("CIFS: SMBD: Upper layer connects to SMBDirect session")
Cc Tom Talpey <[email protected]>
Cc Stefan Metzmacher <[email protected]>
Cc Shyam Prasad N <[email protected]>
Cc Ronnie Sahlberg <[email protected]>
Cc Bharath SM <[email protected]>
Cc Namjae Jeon <[email protected]>
---
 fs/cifs/connect.c | 1 +
 1 file changed, 1 insertion(+)
fs/cifs/connect.c +1 -0
index a95b9d2318fa2..db54cbbe8cc5e 100644
@@ -2676,6 +2676,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
 			kfree(tcp_ses->hostname);
 		if (tcp_ses->ssocket)
 			sock_release(tcp_ses->ssocket);
+		smbd_destroy(tcp_ses);
 		kfree(tcp_ses);
 	}
 	return ERR_PTR(rc);
Signature · 1 line
2.53.0