[PATCH 4/7] ksmbd: return STATUS_OBJECT_NAME_NOT_FOUND for unknown IPC pipe names

"Gaël Blivet-Bailly" <[email protected]>
Newsgroups org.kernel.vger.linux-cifs
Message-ID <[email protected]>
From: Gael Blivet <[email protected]>

create_smb2_pipe() maps ksmbd_session_rpc_open() failing with -EINVAL
(pipe name not recognized/supported) to STATUS_INVALID_PARAMETER.
macOS Time Machine's backupd treats STATUS_INVALID_PARAMETER on a
pipe open as a fatal error and aborts the backup immediately, whereas
STATUS_OBJECT_NAME_NOT_FOUND is handled gracefully -- the client just
treats that particular pipe as unavailable and continues.

Link: https://github.com/namjaejeon/ksmbd/issues/502

Signed-off-by: Gael Blivet <[email protected]>
---
 fs/smb/server/smb2pdu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 735c3eb72..af957d013 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -2646,7 +2646,13 @@ static noinline int create_smb2_pipe(struct ksmbd_work *work)
 out:
 	switch (err) {
 	case -EINVAL:
-		rsp->hdr.Status = STATUS_INVALID_PARAMETER;
+		/*
+		 * Unknown pipe name: return STATUS_OBJECT_NAME_NOT_FOUND so
+		 * macOS clients skip it gracefully. STATUS_INVALID_PARAMETER
+		 * causes macOS Time Machine to abort the backup immediately
+		 * (confirmed in ksmbd issue #502 / namjaejeon/ksmbd).
+		 */
+		rsp->hdr.Status = STATUS_OBJECT_NAME_NOT_FOUND;
 		break;
 	case -ENOSPC:
 	case -ENOMEM:
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.