FAILED: patch "[PATCH] ksmbd: send proper error response in smb2_tree_connect()" failed to apply to 5.15-stable tree
[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]>.
Possible dependencies:
cdfb2fef522d ("ksmbd: send proper error response in smb2_tree_connect()") cb4517201b8a ("ksmbd: remove smb2_buf_length in smb2_hdr") 341b16014bf8 ("ksmdb: use cmd helper variable in smb2_get_ksmbd_tcon()")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From cdfb2fef522d0c3f9cf293db51de88e9b3d46846 Mon Sep 17 00:00:00 2001
From: Marios Makassikis <[email protected]>
Date: Fri, 23 Dec 2022 11:59:31 +0100
Subject: [PATCH] ksmbd: send proper error response in smb2_tree_connect()
Currently, smb2_tree_connect doesn't send an error response packet on error.
This causes libsmb2 to skip the specific error code and fail with the following:
smb2_service failed with : Failed to parse fixed part of command payload. Unexpected size of Error reply. Expected 9, got 8
fs/ksmbd/smb2pdu.c +5 -2
@@ -1928,13 +1928,13 @@ int smb2_tree_connect(struct ksmbd_work *work)if (conn->posix_ext_supported) status.tree_conn->posix_extensions = true; -out_err1: rsp->StructureSize =cpu_to_le16 (16 ); +inc_rfc1001_len (work->response_buf,16 ); +out_err1: rsp->Capabilities =0 ; rsp->Reserved =0 ;/* default manual caching */ rsp->ShareFlags =SMB2_SHAREFLAG_MANUAL_CACHING ; -inc_rfc1001_len (work->response_buf,16 );if (!IS_ERR (treename))kfree (treename);
@@ -1967,6 +1967,9 @@ int smb2_tree_connect(struct ksmbd_work *work) rsp->hdr.Status =STATUS_ACCESS_DENIED ; } +if (status.ret !=KSMBD_TREE_CONN_STATUS_OK ) +smb2_set_err_rsp (work); +return rc; }