@@ -184,23 +184,6 @@ static void __handle_ksmbd_work(struct ksmbd_work *work,
goto send;
}
- if (conn->ops->check_user_session) {
- rc = conn->ops->check_user_session(work);
- if (rc < 0) {
- command = conn->ops->get_cmd_val(work);
- conn->ops->set_rsp_status(work,
- STATUS_USER_SESSION_DELETED);
- goto send;
- } else if (rc > 0) {
- rc = conn->ops->get_ksmbd_tcon(work);
- if (rc < 0) {
- conn->ops->set_rsp_status(work,
- STATUS_NETWORK_NAME_DELETED);
- goto send;
- }
- }
- }
-
do {
rc = __process_request(work, conn, &command);
if (rc == SERVER_HANDLER_ABORT)
@@ -334,6 +334,7 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work)
int command;
__u32 clc_len; /* calculated length */
__u32 len = ksmbd_smb2_cur_pdu_buflen(work);
+ int rc;
if (check_smb2_hdr(hdr))
return 1;
@@ -416,6 +417,25 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work)
return 1;
}
+ if (work->conn->ops->check_user_session == NULL)
+ return 0;
+
+ rc = work->conn->ops->check_user_session(work);
+ if (rc < 0) {
+ work->conn->ops->set_rsp_status(work,
+ STATUS_USER_SESSION_DELETED);
+ return 1;
+ }
+ if (rc == 0)
+ return 0;
+
+ rc = work->conn->ops->get_ksmbd_tcon(work);
+ if (rc < 0) {
+ work->conn->ops->set_rsp_status(work,
+ STATUS_NETWORK_NAME_DELETED);
+ return 1;
+ }
+
return 0;
}
For compound non-related operations session id and tree id must be taken from earch PDU. Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Tom Talpey <tom@talpey.com> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Cc: Steve French <smfrench@gmail.com> Cc: Hyunchul Lee <hyc.lee@gmail.com> Signed-off-by: Ralph Boehme <slow@samba.org> --- fs/ksmbd/server.c | 17 ----------------- fs/ksmbd/smb2misc.c | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 17 deletions(-)