Skip to contentSkip to conversation

FAILED: patch "[PATCH] ksmbd: revert fsids on durable reconnect and replay failure" failed to apply to 6.18-stable tree

PATCH New Sasha Levin 1 participant 2 messages Nov 10 – Nov 11

Subsystems (2)
lore
Share & tools
lore

Sasha Levin

author maintainer
#0 lore raw

The patch below does not apply to the 6.18-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.18.y
git checkout FETCH_HEAD
git cherry-pick -x 539223f18026448f67d33d09719c355b91db7fd0
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'

Thanks,
Sasha

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

From 539223f18026448f67d33d09719c355b91db7fd0 Mon Sep 17 00:00:00 2001
From: Ian Bridges <[email protected]>
Date: Wed, 28 Oct 2026 20:28:03 -0500
Subject: [PATCH] ksmbd: revert fsids on durable reconnect and replay failure

On a durable handle reconnect or a request replay, smb2_open() switches to the SMB user's fsids before calling ksmbd_vfs_getattr(). If that call fails, the code jumps to err_out2 and skips ksmbd_revert_fsids() at err_out1. The user's credentials then stay installed on the shared ksmbd worker. Later work on that worker, including other users' requests, runs with the first user's fsuid, fsgid and supplementary groups. ksmbd_free_work_struct() also warns, because work->saved_cred is still set.

Jump to err_out1 instead. No path is held at this point, so skipping the path_put() at err_out is correct.

Fixes c8efcc786146 ("ksmbd: add support for durable handles v1/v2")
Fixes bb8bf7eb13b5 ("ksmbd: add SMB3 request replay support")
---
 fs/smb/server/smb2pdu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/smb/server/smb2pdu.c +2 -2
index 528bb4ac97e16..2e955d272f4bc 100644
@@ -4530,7 +4530,7 @@ int smb2_open(struct ksmbd_work *work)
 			file_info = FILE_OPENED;
 			rc = ksmbd_vfs_getattr(&fp->filp->f_path, &stat);
 			if (rc)
-				goto err_out2;
+				goto err_out1;
 
 			goto reconnected_fp;
 		}
@@ -4560,7 +4560,7 @@ int smb2_open(struct ksmbd_work *work)
 
 			rc = ksmbd_vfs_getattr(&fp->filp->f_path, &stat);
 			if (rc)
-				goto err_out2;
+				goto err_out1;
 
 			goto reconnected_fp;
 		}
Signature · 1 line
2.53.0
author maintainer
#1 lore raw

PATCH 1/1 ksmbd: revert fsids on durable reconnect and replay failure

From: Ian Bridges <[email protected]>

[ Upstream commit 539223f18026448f67d33d09719c355b91db7fd0 ]

On a durable handle reconnect or a request replay, smb2_open() switches to the SMB user's fsids before calling ksmbd_vfs_getattr(). If that call fails, the code jumps to err_out2 and skips ksmbd_revert_fsids() at err_out1. The user's credentials then stay installed on the shared ksmbd worker. Later work on that worker, including other users' requests, runs with the first user's fsuid, fsgid and supplementary groups. ksmbd_free_work_struct() also warns, because work->saved_cred is still set.

Jump to err_out1 instead. No path is held at this point, so skipping the path_put() at err_out is correct.

Fixes c8efcc786146 ("ksmbd: add support for durable handles v1/v2")
Fixes bb8bf7eb13b5 ("ksmbd: add SMB3 request replay support")
[ sashal: omitted the hunk for the absent dh_info.replay branch ]
---
 fs/smb/server/smb2pdu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/server/smb2pdu.c +1 -1
index ec4c54c9c6dc9..6ad50aab3dfcb 100644
@@ -3125,7 +3125,7 @@ int smb2_open(struct ksmbd_work *work)
 
 			rc = ksmbd_vfs_getattr(&fp->filp->f_path, &stat);
 			if (rc)
-				goto err_out2;
+				goto err_out1;
 
 			goto reconnected_fp;
 		}
Signature · 1 line
2.53.0