Lines Matching refs:work

42 static void __wbuf(struct ksmbd_work *work, void **req, void **rsp)  in __wbuf()  argument
44 if (work->next_smb2_rcv_hdr_off) { in __wbuf()
45 *req = ksmbd_req_buf_next(work); in __wbuf()
46 *rsp = ksmbd_resp_buf_next(work); in __wbuf()
48 *req = smb2_get_msg(work->request_buf); in __wbuf()
49 *rsp = smb2_get_msg(work->response_buf); in __wbuf()
88 int smb2_get_ksmbd_tcon(struct ksmbd_work *work) in smb2_get_ksmbd_tcon() argument
90 struct smb2_hdr *req_hdr = ksmbd_req_buf_next(work); in smb2_get_ksmbd_tcon()
101 if (xa_empty(&work->sess->tree_conns)) { in smb2_get_ksmbd_tcon()
112 if (work->next_smb2_rcv_hdr_off) { in smb2_get_ksmbd_tcon()
113 if (!work->tcon) { in smb2_get_ksmbd_tcon()
117 if (tree_id != UINT_MAX && work->tcon->id != tree_id) { in smb2_get_ksmbd_tcon()
119 tree_id, work->tcon->id); in smb2_get_ksmbd_tcon()
125 work->tcon = ksmbd_tree_conn_lookup(work->sess, tree_id); in smb2_get_ksmbd_tcon()
126 if (!work->tcon) { in smb2_get_ksmbd_tcon()
138 void smb2_set_err_rsp(struct ksmbd_work *work) in smb2_set_err_rsp() argument
142 if (work->next_smb2_rcv_hdr_off) in smb2_set_err_rsp()
143 err_rsp = ksmbd_resp_buf_next(work); in smb2_set_err_rsp()
145 err_rsp = smb2_get_msg(work->response_buf); in smb2_set_err_rsp()
155 err = ksmbd_iov_pin_rsp(work, (void *)err_rsp, in smb2_set_err_rsp()
159 work->send_no_response = 1; in smb2_set_err_rsp()
169 bool is_smb2_neg_cmd(struct ksmbd_work *work) in is_smb2_neg_cmd() argument
171 struct smb2_hdr *hdr = smb2_get_msg(work->request_buf); in is_smb2_neg_cmd()
193 bool is_smb2_rsp(struct ksmbd_work *work) in is_smb2_rsp() argument
195 struct smb2_hdr *hdr = smb2_get_msg(work->response_buf); in is_smb2_rsp()
214 u16 get_smb2_cmd_val(struct ksmbd_work *work) in get_smb2_cmd_val() argument
218 if (work->next_smb2_rcv_hdr_off) in get_smb2_cmd_val()
219 rcv_hdr = ksmbd_req_buf_next(work); in get_smb2_cmd_val()
221 rcv_hdr = smb2_get_msg(work->request_buf); in get_smb2_cmd_val()
230 void set_smb2_rsp_status(struct ksmbd_work *work, __le32 err) in set_smb2_rsp_status() argument
234 rsp_hdr = smb2_get_msg(work->response_buf); in set_smb2_rsp_status()
237 work->iov_idx = 0; in set_smb2_rsp_status()
238 work->iov_cnt = 0; in set_smb2_rsp_status()
239 work->next_smb2_rcv_hdr_off = 0; in set_smb2_rsp_status()
240 smb2_set_err_rsp(work); in set_smb2_rsp_status()
250 int init_smb2_neg_rsp(struct ksmbd_work *work) in init_smb2_neg_rsp() argument
254 struct ksmbd_conn *conn = work->conn; in init_smb2_neg_rsp()
257 rsp_hdr = smb2_get_msg(work->response_buf); in init_smb2_neg_rsp()
271 rsp = smb2_get_msg(work->response_buf); in init_smb2_neg_rsp()
297 err = ksmbd_iov_pin_rsp(work, rsp, in init_smb2_neg_rsp()
311 int smb2_set_rsp_credits(struct ksmbd_work *work) in smb2_set_rsp_credits() argument
313 struct smb2_hdr *req_hdr = ksmbd_req_buf_next(work); in smb2_set_rsp_credits()
314 struct smb2_hdr *hdr = ksmbd_resp_buf_next(work); in smb2_set_rsp_credits()
315 struct ksmbd_conn *conn = work->conn; in smb2_set_rsp_credits()
319 if (work->send_no_response) in smb2_set_rsp_credits()
356 work->credits_granted += credits_granted; in smb2_set_rsp_credits()
360 hdr->CreditRequest = cpu_to_le16(work->credits_granted); in smb2_set_rsp_credits()
373 static void init_chained_smb2_rsp(struct ksmbd_work *work) in init_chained_smb2_rsp() argument
375 struct smb2_hdr *req = ksmbd_req_buf_next(work); in init_chained_smb2_rsp()
376 struct smb2_hdr *rsp = ksmbd_resp_buf_next(work); in init_chained_smb2_rsp()
390 work->compound_fid = ((struct smb2_create_rsp *)rsp)->VolatileFileId; in init_chained_smb2_rsp()
391 work->compound_pfid = ((struct smb2_create_rsp *)rsp)->PersistentFileId; in init_chained_smb2_rsp()
392 work->compound_sid = le64_to_cpu(rsp->SessionId); in init_chained_smb2_rsp()
395 len = get_rfc1002_len(work->response_buf) - work->next_smb2_rsp_hdr_off; in init_chained_smb2_rsp()
399 work->iov[work->iov_idx].iov_len += (new_len - len); in init_chained_smb2_rsp()
400 inc_rfc1001_len(work->response_buf, new_len - len); in init_chained_smb2_rsp()
403 work->next_smb2_rcv_hdr_off += next_hdr_offset; in init_chained_smb2_rsp()
404 work->curr_smb2_rsp_hdr_off = work->next_smb2_rsp_hdr_off; in init_chained_smb2_rsp()
405 work->next_smb2_rsp_hdr_off += new_len; in init_chained_smb2_rsp()
408 new_len, work->next_smb2_rcv_hdr_off, in init_chained_smb2_rsp()
409 work->next_smb2_rsp_hdr_off); in init_chained_smb2_rsp()
411 rsp_hdr = ksmbd_resp_buf_next(work); in init_chained_smb2_rsp()
412 rcv_hdr = ksmbd_req_buf_next(work); in init_chained_smb2_rsp()
416 work->compound_fid = KSMBD_NO_FID; in init_chained_smb2_rsp()
417 work->compound_pfid = KSMBD_NO_FID; in init_chained_smb2_rsp()
443 bool is_chained_smb2_message(struct ksmbd_work *work) in is_chained_smb2_message() argument
445 struct smb2_hdr *hdr = smb2_get_msg(work->request_buf); in is_chained_smb2_message()
451 hdr = ksmbd_req_buf_next(work); in is_chained_smb2_message()
454 if ((u64)work->next_smb2_rcv_hdr_off + next_cmd + in is_chained_smb2_message()
456 get_rfc1002_len(work->request_buf)) { in is_chained_smb2_message()
462 if ((u64)get_rfc1002_len(work->response_buf) + MAX_CIFS_SMALL_BUFFER_SIZE > in is_chained_smb2_message()
463 work->response_sz) { in is_chained_smb2_message()
469 init_chained_smb2_rsp(work); in is_chained_smb2_message()
471 } else if (work->next_smb2_rcv_hdr_off) { in is_chained_smb2_message()
476 len = ALIGN(get_rfc1002_len(work->response_buf), 8); in is_chained_smb2_message()
477 len = len - get_rfc1002_len(work->response_buf); in is_chained_smb2_message()
480 work->iov[work->iov_idx].iov_len += len; in is_chained_smb2_message()
481 inc_rfc1001_len(work->response_buf, len); in is_chained_smb2_message()
483 work->curr_smb2_rsp_hdr_off = work->next_smb2_rsp_hdr_off; in is_chained_smb2_message()
494 int init_smb2_rsp_hdr(struct ksmbd_work *work) in init_smb2_rsp_hdr() argument
496 struct smb2_hdr *rsp_hdr = smb2_get_msg(work->response_buf); in init_smb2_rsp_hdr()
497 struct smb2_hdr *rcv_hdr = smb2_get_msg(work->request_buf); in init_smb2_rsp_hdr()
524 int smb2_allocate_rsp_buf(struct ksmbd_work *work) in smb2_allocate_rsp_buf() argument
526 struct smb2_hdr *hdr = smb2_get_msg(work->request_buf); in smb2_allocate_rsp_buf()
528 size_t large_sz = small_sz + work->conn->vals->max_trans_size; in smb2_allocate_rsp_buf()
538 req = smb2_get_msg(work->request_buf); in smb2_allocate_rsp_buf()
550 work->response_buf = kvzalloc(sz, GFP_KERNEL); in smb2_allocate_rsp_buf()
551 if (!work->response_buf) in smb2_allocate_rsp_buf()
554 work->response_sz = sz; in smb2_allocate_rsp_buf()
564 int smb2_check_user_session(struct ksmbd_work *work) in smb2_check_user_session() argument
566 struct smb2_hdr *req_hdr = ksmbd_req_buf_next(work); in smb2_check_user_session()
567 struct ksmbd_conn *conn = work->conn; in smb2_check_user_session()
589 if (work->next_smb2_rcv_hdr_off) { in smb2_check_user_session()
590 if (!work->sess) { in smb2_check_user_session()
594 if (sess_id != ULLONG_MAX && work->sess->id != sess_id) { in smb2_check_user_session()
596 sess_id, work->sess->id); in smb2_check_user_session()
603 work->sess = ksmbd_session_lookup_all(conn, sess_id); in smb2_check_user_session()
604 if (work->sess) in smb2_check_user_session()
658 int setup_async_work(struct ksmbd_work *work, void (*fn)(void **), void **arg) in setup_async_work() argument
660 struct ksmbd_conn *conn = work->conn; in setup_async_work()
668 work->asynchronous = true; in setup_async_work()
669 work->async_id = id; in setup_async_work()
673 work->async_id); in setup_async_work()
675 work->cancel_fn = fn; in setup_async_work()
676 work->cancel_argv = arg; in setup_async_work()
678 if (list_empty(&work->async_request_entry)) { in setup_async_work()
680 list_add_tail(&work->async_request_entry, &conn->async_requests); in setup_async_work()
687 void release_async_work(struct ksmbd_work *work) in release_async_work() argument
689 struct ksmbd_conn *conn = work->conn; in release_async_work()
692 list_del_init(&work->async_request_entry); in release_async_work()
695 work->asynchronous = 0; in release_async_work()
696 work->cancel_fn = NULL; in release_async_work()
697 kfree(work->cancel_argv); in release_async_work()
698 work->cancel_argv = NULL; in release_async_work()
699 if (work->async_id) { in release_async_work()
700 ksmbd_release_id(&conn->async_ida, work->async_id); in release_async_work()
701 work->async_id = 0; in release_async_work()
705 void smb2_send_interim_resp(struct ksmbd_work *work, __le32 status) in smb2_send_interim_resp() argument
716 in_work->conn = work->conn; in smb2_send_interim_resp()
717 memcpy(smb2_get_msg(in_work->response_buf), ksmbd_resp_buf_next(work), in smb2_send_interim_resp()
722 rsp_hdr->Id.AsyncId = cpu_to_le64(work->async_id); in smb2_send_interim_resp()
1095 int smb2_handle_negotiate(struct ksmbd_work *work) in smb2_handle_negotiate() argument
1097 struct ksmbd_conn *conn = work->conn; in smb2_handle_negotiate()
1098 struct smb2_negotiate_req *req = smb2_get_msg(work->request_buf); in smb2_handle_negotiate()
1099 struct smb2_negotiate_rsp *rsp = smb2_get_msg(work->response_buf); in smb2_handle_negotiate()
1108 work->send_no_response = 1; in smb2_handle_negotiate()
1112 smb2_buf_len = get_rfc1002_len(work->request_buf); in smb2_handle_negotiate()
1170 get_rfc1002_len(work->request_buf)); in smb2_handle_negotiate()
1190 work->request_buf, in smb2_handle_negotiate()
1266 rc = ksmbd_iov_pin_rsp(work, rsp, in smb2_handle_negotiate()
1270 smb2_set_err_rsp(work); in smb2_handle_negotiate()
1288 static int generate_preauth_hash(struct ksmbd_work *work) in generate_preauth_hash() argument
1290 struct ksmbd_conn *conn = work->conn; in generate_preauth_hash()
1291 struct ksmbd_session *sess = work->sess; in generate_preauth_hash()
1315 ksmbd_gen_preauth_integrity_hash(conn, work->request_buf, preauth_hash); in generate_preauth_hash()
1336 static int ntlm_negotiate(struct ksmbd_work *work, in ntlm_negotiate() argument
1347 rc = ksmbd_decode_ntlmssp_neg_blob(negblob, negblob_len, work->conn); in ntlm_negotiate()
1356 if (!work->conn->use_spnego) { in ntlm_negotiate()
1357 sz = ksmbd_build_ntlmssp_challenge_blob(chgblob, work->conn); in ntlm_negotiate()
1373 sz = ksmbd_build_ntlmssp_challenge_blob(chgblob, work->conn); in ntlm_negotiate()
1447 static int ntlm_authenticate(struct ksmbd_work *work, in ntlm_authenticate() argument
1451 struct ksmbd_conn *conn = work->conn; in ntlm_authenticate()
1452 struct ksmbd_session *sess = work->sess; in ntlm_authenticate()
1586 static int krb5_authenticate(struct ksmbd_work *work, in krb5_authenticate() argument
1590 struct ksmbd_conn *conn = work->conn; in krb5_authenticate()
1591 struct ksmbd_session *sess = work->sess; in krb5_authenticate()
1603 out_len = work->response_sz - in krb5_authenticate()
1666 static int krb5_authenticate(struct ksmbd_work *work, in krb5_authenticate() argument
1674 int smb2_sess_setup(struct ksmbd_work *work) in smb2_sess_setup() argument
1676 struct ksmbd_conn *conn = work->conn; in smb2_sess_setup()
1686 WORK_BUFFERS(work, req, rsp); in smb2_sess_setup()
1783 work->sess = sess; in smb2_sess_setup()
1808 rc = generate_preauth_hash(work); in smb2_sess_setup()
1814 rc = krb5_authenticate(work, req, rsp); in smb2_sess_setup()
1828 rc = ntlm_negotiate(work, negblob, negblob_len, rsp); in smb2_sess_setup()
1834 rc = ntlm_authenticate(work, req, rsp); in smb2_sess_setup()
1917 smb2_set_err_rsp(work); in smb2_sess_setup()
1926 rc = ksmbd_iov_pin_rsp(work, rsp, iov_len); in smb2_sess_setup()
1941 int smb2_tree_connect(struct ksmbd_work *work) in smb2_tree_connect() argument
1943 struct ksmbd_conn *conn = work->conn; in smb2_tree_connect()
1946 struct ksmbd_session *sess = work->sess; in smb2_tree_connect()
1952 WORK_BUFFERS(work, req, rsp); in smb2_tree_connect()
2016 rc = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_tree_connect_rsp)); in smb2_tree_connect()
2052 smb2_set_err_rsp(work); in smb2_tree_connect()
2126 int smb2_tree_disconnect(struct ksmbd_work *work) in smb2_tree_disconnect() argument
2130 struct ksmbd_session *sess = work->sess; in smb2_tree_disconnect()
2131 struct ksmbd_tree_connect *tcon = work->tcon; in smb2_tree_disconnect()
2134 WORK_BUFFERS(work, req, rsp); in smb2_tree_disconnect()
2146 ksmbd_close_tree_conn_fds(work); in smb2_tree_disconnect()
2166 work->tcon = NULL; in smb2_tree_disconnect()
2169 err = ksmbd_iov_pin_rsp(work, rsp, in smb2_tree_disconnect()
2179 smb2_set_err_rsp(work); in smb2_tree_disconnect()
2190 int smb2_session_logoff(struct ksmbd_work *work) in smb2_session_logoff() argument
2192 struct ksmbd_conn *conn = work->conn; in smb2_session_logoff()
2199 WORK_BUFFERS(work, req, rsp); in smb2_session_logoff()
2207 smb2_set_err_rsp(work); in smb2_session_logoff()
2214 ksmbd_close_session_fds(work); in smb2_session_logoff()
2225 smb2_set_err_rsp(work); in smb2_session_logoff()
2237 err = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_logoff_rsp)); in smb2_session_logoff()
2240 smb2_set_err_rsp(work); in smb2_session_logoff()
2252 static noinline int create_smb2_pipe(struct ksmbd_work *work) in create_smb2_pipe() argument
2260 WORK_BUFFERS(work, req, rsp); in create_smb2_pipe()
2263 1, work->conn->local_nls); in create_smb2_pipe()
2270 id = ksmbd_session_rpc_open(work->sess, name); in create_smb2_pipe()
2295 err = ksmbd_iov_pin_rsp(work, rsp, offsetof(struct smb2_create_rsp, Buffer)); in create_smb2_pipe()
2316 smb2_set_err_rsp(work); in create_smb2_pipe()
2559 static int smb2_creat(struct ksmbd_work *work, struct path *parent_path, in smb2_creat() argument
2563 struct ksmbd_tree_connect *tcon = work->tcon; in smb2_creat()
2576 rc = ksmbd_vfs_mkdir(work, name, mode); in smb2_creat()
2583 rc = ksmbd_vfs_create(work, name, mode); in smb2_creat()
2588 rc = ksmbd_vfs_kern_path_locked(work, name, 0, parent_path, path, 0); in smb2_creat()
2597 static int smb2_create_sd_buffer(struct ksmbd_work *work, in smb2_create_sd_buffer() argument
2621 return set_info_sec(work->conn, work->tcon, path, &sd_buf->ntsd, in smb2_create_sd_buffer()
2651 int smb2_open(struct ksmbd_work *work) in smb2_open() argument
2653 struct ksmbd_conn *conn = work->conn; in smb2_open()
2654 struct ksmbd_session *sess = work->sess; in smb2_open()
2655 struct ksmbd_tree_connect *tcon = work->tcon; in smb2_open()
2684 WORK_BUFFERS(work, req, rsp); in smb2_open()
2686 if (req->hdr.NextCommand && !work->next_smb2_rcv_hdr_off && in smb2_open()
2690 smb2_set_err_rsp(work); in smb2_open()
2696 return create_smb2_pipe(work); in smb2_open()
2709 work->conn->local_nls); in smb2_open()
2720 if (!test_share_config_flag(work->tcon->share_conf, in smb2_open()
2871 if (ksmbd_override_fsids(work)) { in smb2_open()
2876 rc = ksmbd_vfs_kern_path_locked(work, name, LOOKUP_NO_SYMLINKS, in smb2_open()
2997 rc = smb2_creat(work, &parent_path, &path, name, open_flags, in smb2_open()
3078 fp = ksmbd_open_fd(work, filp); in smb2_open()
3109 if (test_share_config_flag(work->tcon->share_conf, in smb2_open()
3116 rc = smb2_create_sd_buffer(work, req, &path); in smb2_open()
3122 if (test_share_config_flag(work->tcon->share_conf, in smb2_open()
3206 smb_break_all_oplock(work, fp); in smb2_open()
3215 if (!test_share_config_flag(work->tcon->share_conf, KSMBD_SHARE_FLAG_OPLOCKS) || in smb2_open()
3243 rc = smb_grant_oplock(work, req_op_level, in smb2_open()
3282 smb_break_all_levII_oplock(work, fp, 1); in smb2_open()
3428 ksmbd_revert_fsids(work); in smb2_open()
3432 ksmbd_update_fstate(&work->sess->file_table, fp, FP_INITED); in smb2_open()
3433 rc = ksmbd_iov_pin_rsp(work, (void *)rsp, iov_len); in smb2_open()
3462 ksmbd_fd_put(work, fp); in smb2_open()
3463 smb2_set_err_rsp(work); in smb2_open()
3775 struct ksmbd_work *work; member
3832 ksmbd_vfs_fill_dentry_attrs(priv->work, in process_query_dir_entries()
3837 rc = smb2_populate_readdir_entry(priv->work->conn, in process_query_dir_entries()
3970 if (ksmbd_share_veto_filename(priv->work->tcon->share_conf, name)) in __query_dir()
4003 static int smb2_resp_buf_len(struct ksmbd_work *work, unsigned short hdr2_len) in smb2_resp_buf_len() argument
4007 free_len = (int)(work->response_sz - in smb2_resp_buf_len()
4008 (get_rfc1002_len(work->response_buf) + 4)) - hdr2_len; in smb2_resp_buf_len()
4012 static int smb2_calc_max_out_buf_len(struct ksmbd_work *work, in smb2_calc_max_out_buf_len() argument
4018 if (out_buf_len > work->conn->vals->max_trans_size) in smb2_calc_max_out_buf_len()
4021 free_len = smb2_resp_buf_len(work, hdr2_len); in smb2_calc_max_out_buf_len()
4028 int smb2_query_dir(struct ksmbd_work *work) in smb2_query_dir() argument
4030 struct ksmbd_conn *conn = work->conn; in smb2_query_dir()
4033 struct ksmbd_share_config *share = work->tcon->share_conf; in smb2_query_dir()
4042 WORK_BUFFERS(work, req, rsp); in smb2_query_dir()
4044 if (ksmbd_override_fsids(work)) { in smb2_query_dir()
4046 smb2_set_err_rsp(work); in smb2_query_dir()
4056 dir_fp = ksmbd_lookup_fd_slow(work, req->VolatileFileId, req->PersistentFileId); in smb2_query_dir()
4098 smb2_calc_max_out_buf_len(work, 8, in smb2_query_dir()
4110 rc = ksmbd_populate_dot_dotdot_entries(work, req->FileInformationClass, in smb2_query_dir()
4123 query_dir_private.work = work; in smb2_query_dir()
4160 rc = ksmbd_iov_pin_rsp(work, (void *)rsp, in smb2_query_dir()
4175 rc = ksmbd_iov_pin_rsp(work, (void *)rsp, in smb2_query_dir()
4183 ksmbd_fd_put(work, dir_fp); in smb2_query_dir()
4184 ksmbd_revert_fsids(work); in smb2_query_dir()
4209 smb2_set_err_rsp(work); in smb2_query_dir()
4210 ksmbd_fd_put(work, dir_fp); in smb2_query_dir()
4211 ksmbd_revert_fsids(work); in smb2_query_dir()
4313 static int smb2_get_ea(struct ksmbd_work *work, struct ksmbd_file *fp, in smb2_get_ea() argument
4348 smb2_calc_max_out_buf_len(work, 8, in smb2_get_ea()
4541 static int get_file_all_info(struct ksmbd_work *work, in get_file_all_info() argument
4546 struct ksmbd_conn *conn = work->conn; in get_file_all_info()
4561 filename = convert_to_nt_pathname(work->tcon->share_conf, &fp->filp->f_path); in get_file_all_info()
4605 static void get_file_alternate_info(struct ksmbd_work *work, in get_file_alternate_info() argument
4610 struct ksmbd_conn *conn = work->conn; in get_file_alternate_info()
4626 static void get_file_stream_info(struct ksmbd_work *work, in get_file_stream_info() argument
4631 struct ksmbd_conn *conn = work->conn; in get_file_stream_info()
4639 struct smb2_query_info_req *req = ksmbd_req_buf_next(work); in get_file_stream_info()
4646 smb2_calc_max_out_buf_len(work, 8, in get_file_stream_info()
4887 static int smb2_get_info_file(struct ksmbd_work *work, in smb2_get_info_file() argument
4896 if (test_share_config_flag(work->tcon->share_conf, in smb2_get_info_file()
4899 return smb2_get_info_file_pipe(work->sess, req, rsp, in smb2_get_info_file()
4900 work->response_buf); in smb2_get_info_file()
4903 if (work->next_smb2_rcv_hdr_off) { in smb2_get_info_file()
4906 work->compound_fid); in smb2_get_info_file()
4907 id = work->compound_fid; in smb2_get_info_file()
4908 pid = work->compound_pfid; in smb2_get_info_file()
4917 fp = ksmbd_lookup_fd_slow(work, id, pid); in smb2_get_info_file()
4925 get_file_access_info(rsp, fp, work->response_buf); in smb2_get_info_file()
4929 rc = get_file_basic_info(rsp, fp, work->response_buf); in smb2_get_info_file()
4933 get_file_standard_info(rsp, fp, work->response_buf); in smb2_get_info_file()
4937 get_file_alignment_info(rsp, work->response_buf); in smb2_get_info_file()
4941 rc = get_file_all_info(work, rsp, fp, work->response_buf); in smb2_get_info_file()
4945 get_file_alternate_info(work, rsp, fp, work->response_buf); in smb2_get_info_file()
4949 get_file_stream_info(work, rsp, fp, work->response_buf); in smb2_get_info_file()
4953 get_file_internal_info(rsp, fp, work->response_buf); in smb2_get_info_file()
4957 rc = get_file_network_open_info(rsp, fp, work->response_buf); in smb2_get_info_file()
4961 get_file_ea_info(rsp, work->response_buf); in smb2_get_info_file()
4965 rc = smb2_get_ea(work, fp, req, rsp, work->response_buf); in smb2_get_info_file()
4969 get_file_position_info(rsp, fp, work->response_buf); in smb2_get_info_file()
4973 get_file_mode_info(rsp, fp, work->response_buf); in smb2_get_info_file()
4977 get_file_compression_info(rsp, fp, work->response_buf); in smb2_get_info_file()
4981 rc = get_file_attribute_tag_info(rsp, fp, work->response_buf); in smb2_get_info_file()
4984 if (!work->tcon->posix_extensions) { in smb2_get_info_file()
4988 find_file_posix_info(rsp, fp, work->response_buf); in smb2_get_info_file()
4998 rsp, work->response_buf); in smb2_get_info_file()
4999 ksmbd_fd_put(work, fp); in smb2_get_info_file()
5003 static int smb2_get_info_filesystem(struct ksmbd_work *work, in smb2_get_info_filesystem() argument
5007 struct ksmbd_session *sess = work->sess; in smb2_get_info_filesystem()
5008 struct ksmbd_conn *conn = work->conn; in smb2_get_info_filesystem()
5009 struct ksmbd_share_config *share = work->tcon->share_conf; in smb2_get_info_filesystem()
5060 if (test_share_config_flag(work->tcon->share_conf, in smb2_get_info_filesystem()
5190 if (!work->tcon->posix_extensions) { in smb2_get_info_filesystem()
5211 rsp, work->response_buf); in smb2_get_info_filesystem()
5216 static int smb2_get_info_sec(struct ksmbd_work *work, in smb2_get_info_sec() argument
5249 if (work->next_smb2_rcv_hdr_off) { in smb2_get_info_sec()
5252 work->compound_fid); in smb2_get_info_sec()
5253 id = work->compound_fid; in smb2_get_info_sec()
5254 pid = work->compound_pfid; in smb2_get_info_sec()
5263 fp = ksmbd_lookup_fd_slow(work, id, pid); in smb2_get_info_sec()
5271 if (test_share_config_flag(work->tcon->share_conf, in smb2_get_info_sec()
5273 ppntsd_size = ksmbd_vfs_get_sd_xattr(work->conn, idmap, in smb2_get_info_sec()
5278 if (smb2_resp_buf_len(work, 8) > ppntsd_size) in smb2_get_info_sec()
5284 ksmbd_fd_put(work, fp); in smb2_get_info_sec()
5298 int smb2_query_info(struct ksmbd_work *work) in smb2_query_info() argument
5304 WORK_BUFFERS(work, req, rsp); in smb2_query_info()
5311 rc = smb2_get_info_file(work, req, rsp); in smb2_query_info()
5315 rc = smb2_get_info_filesystem(work, req, rsp); in smb2_query_info()
5319 rc = smb2_get_info_sec(work, req, rsp); in smb2_query_info()
5330 rc = ksmbd_iov_pin_rsp(work, (void *)rsp, in smb2_query_info()
5346 smb2_set_err_rsp(work); in smb2_query_info()
5361 static noinline int smb2_close_pipe(struct ksmbd_work *work) in smb2_close_pipe() argument
5367 WORK_BUFFERS(work, req, rsp); in smb2_close_pipe()
5370 ksmbd_session_rpc_close(work->sess, id); in smb2_close_pipe()
5383 return ksmbd_iov_pin_rsp(work, (void *)rsp, in smb2_close_pipe()
5393 int smb2_close(struct ksmbd_work *work) in smb2_close() argument
5399 struct ksmbd_conn *conn = work->conn; in smb2_close()
5405 WORK_BUFFERS(work, req, rsp); in smb2_close()
5407 if (test_share_config_flag(work->tcon->share_conf, in smb2_close()
5410 return smb2_close_pipe(work); in smb2_close()
5415 sess_id = work->compound_sid; in smb2_close()
5417 work->compound_sid = 0; in smb2_close()
5419 work->compound_sid = sess_id; in smb2_close()
5428 if (work->next_smb2_rcv_hdr_off && in smb2_close()
5430 if (!has_file_id(work->compound_fid)) { in smb2_close()
5439 work->compound_fid, in smb2_close()
5440 work->compound_pfid); in smb2_close()
5441 volatile_id = work->compound_fid; in smb2_close()
5444 work->compound_fid = KSMBD_NO_FID; in smb2_close()
5445 work->compound_pfid = KSMBD_NO_FID; in smb2_close()
5456 fp = ksmbd_lookup_fd_fast(work, volatile_id); in smb2_close()
5475 ksmbd_fd_put(work, fp); in smb2_close()
5487 err = ksmbd_close_fd(work, volatile_id); in smb2_close()
5490 err = ksmbd_iov_pin_rsp(work, (void *)rsp, in smb2_close()
5496 smb2_set_err_rsp(work); in smb2_close()
5508 int smb2_echo(struct ksmbd_work *work) in smb2_echo() argument
5510 struct smb2_echo_rsp *rsp = smb2_get_msg(work->response_buf); in smb2_echo()
5512 if (work->next_smb2_rcv_hdr_off) in smb2_echo()
5513 rsp = ksmbd_resp_buf_next(work); in smb2_echo()
5517 return ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_echo_rsp)); in smb2_echo()
5520 static int smb2_rename(struct ksmbd_work *work, in smb2_rename() argument
5584 smb_break_all_levII_oplock(work, fp, 0); in smb2_rename()
5585 rc = ksmbd_vfs_rename(work, &fp->filp->f_path, new_name, flags); in smb2_rename()
5591 static int smb2_create_link(struct ksmbd_work *work, in smb2_create_link() argument
5627 rc = ksmbd_vfs_kern_path_locked(work, link_name, LOOKUP_NO_SYMLINKS, in smb2_create_link()
5637 rc = ksmbd_vfs_remove_file(work, &path); in smb2_create_link()
5653 rc = ksmbd_vfs_link(work, target_name, link_name); in smb2_create_link()
5750 static int set_file_allocation_info(struct ksmbd_work *work, in set_file_allocation_info() argument
5771 smb_break_all_levII_oplock(work, fp, 1); in set_file_allocation_info()
5789 rc = ksmbd_vfs_truncate(work, fp, alloc_blks * 512); in set_file_allocation_info()
5800 static int set_end_of_file_info(struct ksmbd_work *work, struct ksmbd_file *fp, in set_end_of_file_info() argument
5822 rc = ksmbd_vfs_truncate(work, fp, newsize); in set_end_of_file_info()
5833 static int set_rename_info(struct ksmbd_work *work, struct ksmbd_file *fp, in set_rename_info() argument
5849 return smb2_rename(work, fp, rename_info, work->conn->local_nls); in set_rename_info()
5928 static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp, in smb2_set_info_file() argument
5947 return set_file_allocation_info(work, fp, in smb2_set_info_file()
5955 return set_end_of_file_info(work, fp, in smb2_set_info_file()
5963 return set_rename_info(work, fp, in smb2_set_info_file()
5972 return smb2_create_link(work, work->tcon->share_conf, in smb2_set_info_file()
5975 work->conn->local_nls); in smb2_set_info_file()
6036 int smb2_set_info(struct ksmbd_work *work) in smb2_set_info() argument
6046 if (work->next_smb2_rcv_hdr_off) { in smb2_set_info()
6047 req = ksmbd_req_buf_next(work); in smb2_set_info()
6048 rsp = ksmbd_resp_buf_next(work); in smb2_set_info()
6051 work->compound_fid); in smb2_set_info()
6052 id = work->compound_fid; in smb2_set_info()
6053 pid = work->compound_pfid; in smb2_set_info()
6056 req = smb2_get_msg(work->request_buf); in smb2_set_info()
6057 rsp = smb2_get_msg(work->response_buf); in smb2_set_info()
6060 if (!test_tree_conn_flag(work->tcon, KSMBD_TREE_CONN_FLAG_WRITABLE)) { in smb2_set_info()
6072 fp = ksmbd_lookup_fd_slow(work, id, pid); in smb2_set_info()
6082 rc = smb2_set_info_file(work, fp, req, work->tcon->share_conf); in smb2_set_info()
6086 if (ksmbd_override_fsids(work)) { in smb2_set_info()
6094 ksmbd_revert_fsids(work); in smb2_set_info()
6104 rc = ksmbd_iov_pin_rsp(work, (void *)rsp, in smb2_set_info()
6108 ksmbd_fd_put(work, fp); in smb2_set_info()
6130 smb2_set_err_rsp(work); in smb2_set_info()
6131 ksmbd_fd_put(work, fp); in smb2_set_info()
6142 static noinline int smb2_read_pipe(struct ksmbd_work *work) in smb2_read_pipe() argument
6150 WORK_BUFFERS(work, req, rsp); in smb2_read_pipe()
6154 rpc_resp = ksmbd_rpc_read(work->sess, id); in smb2_read_pipe()
6173 err = ksmbd_iov_pin_rsp_read(work, (void *)rsp, in smb2_read_pipe()
6182 err = ksmbd_iov_pin_rsp(work, (void *)rsp, in smb2_read_pipe()
6198 smb2_set_err_rsp(work); in smb2_read_pipe()
6203 static int smb2_set_remote_key_for_rdma(struct ksmbd_work *work, in smb2_set_remote_key_for_rdma() argument
6210 if (work->conn->dialect == SMB30_PROT_ID && in smb2_set_remote_key_for_rdma()
6226 work->need_invalidate_rkey = in smb2_set_remote_key_for_rdma()
6229 work->remote_key = le32_to_cpu(desc->token); in smb2_set_remote_key_for_rdma()
6233 static ssize_t smb2_read_rdma_channel(struct ksmbd_work *work, in smb2_read_rdma_channel() argument
6239 err = ksmbd_conn_rdma_write(work->conn, data_buf, length, in smb2_read_rdma_channel()
6255 int smb2_read(struct ksmbd_work *work) in smb2_read() argument
6257 struct ksmbd_conn *conn = work->conn; in smb2_read()
6270 if (test_share_config_flag(work->tcon->share_conf, in smb2_read()
6273 return smb2_read_pipe(work); in smb2_read()
6276 if (work->next_smb2_rcv_hdr_off) { in smb2_read()
6277 req = ksmbd_req_buf_next(work); in smb2_read()
6278 rsp = ksmbd_resp_buf_next(work); in smb2_read()
6281 work->compound_fid); in smb2_read()
6282 id = work->compound_fid; in smb2_read()
6283 pid = work->compound_pfid; in smb2_read()
6286 req = smb2_get_msg(work->request_buf); in smb2_read()
6287 rsp = smb2_get_msg(work->response_buf); in smb2_read()
6308 err = smb2_set_remote_key_for_rdma(work, in smb2_read()
6317 fp = ksmbd_lookup_fd_slow(work, id, pid); in smb2_read()
6349 nbytes = ksmbd_vfs_read(work, fp, length, &offset, aux_payload_buf); in smb2_read()
6358 smb2_set_err_rsp(work); in smb2_read()
6359 ksmbd_fd_put(work, fp); in smb2_read()
6368 remain_bytes = smb2_read_rdma_channel(work, req, in smb2_read()
6386 err = ksmbd_iov_pin_rsp_read(work, (void *)rsp, in smb2_read()
6393 ksmbd_fd_put(work, fp); in smb2_read()
6413 smb2_set_err_rsp(work); in smb2_read()
6415 ksmbd_fd_put(work, fp); in smb2_read()
6425 static noinline int smb2_write_pipe(struct ksmbd_work *work) in smb2_write_pipe() argument
6435 WORK_BUFFERS(work, req, rsp); in smb2_write_pipe()
6441 get_rfc1002_len(work->request_buf)) { in smb2_write_pipe()
6444 get_rfc1002_len(work->request_buf)); in smb2_write_pipe()
6452 rpc_resp = ksmbd_rpc_write(work->sess, id, data_buf, length); in smb2_write_pipe()
6457 smb2_set_err_rsp(work); in smb2_write_pipe()
6462 smb2_set_err_rsp(work); in smb2_write_pipe()
6475 err = ksmbd_iov_pin_rsp(work, (void *)rsp, in smb2_write_pipe()
6480 smb2_set_err_rsp(work); in smb2_write_pipe()
6486 static ssize_t smb2_write_rdma_channel(struct ksmbd_work *work, in smb2_write_rdma_channel() argument
6499 ret = ksmbd_conn_rdma_read(work->conn, data_buf, length, in smb2_write_rdma_channel()
6508 ret = ksmbd_vfs_write(work, fp, data_buf, length, &offset, sync, &nbytes); in smb2_write_rdma_channel()
6522 int smb2_write(struct ksmbd_work *work) in smb2_write() argument
6533 unsigned int max_write_size = work->conn->vals->max_write_size; in smb2_write()
6535 WORK_BUFFERS(work, req, rsp); in smb2_write()
6537 if (test_share_config_flag(work->tcon->share_conf, KSMBD_SHARE_FLAG_PIPE)) { in smb2_write()
6539 return smb2_write_pipe(work); in smb2_write()
6560 err = smb2_set_remote_key_for_rdma(work, in smb2_write()
6569 if (!test_tree_conn_flag(work->tcon, KSMBD_TREE_CONN_FLAG_WRITABLE)) { in smb2_write()
6575 fp = ksmbd_lookup_fd_slow(work, req->VolatileFileId, req->PersistentFileId); in smb2_write()
6610 err = ksmbd_vfs_write(work, fp, data_buf, length, &offset, in smb2_write()
6618 nbytes = smb2_write_rdma_channel(work, req, fp, offset, length, in smb2_write()
6632 err = ksmbd_iov_pin_rsp(work, rsp, offsetof(struct smb2_write_rsp, Buffer)); in smb2_write()
6635 ksmbd_fd_put(work, fp); in smb2_write()
6654 smb2_set_err_rsp(work); in smb2_write()
6655 ksmbd_fd_put(work, fp); in smb2_write()
6665 int smb2_flush(struct ksmbd_work *work) in smb2_flush() argument
6671 WORK_BUFFERS(work, req, rsp); in smb2_flush()
6675 err = ksmbd_vfs_fsync(work, req->VolatileFileId, req->PersistentFileId); in smb2_flush()
6681 return ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_flush_rsp)); in smb2_flush()
6685 smb2_set_err_rsp(work); in smb2_flush()
6695 int smb2_cancel(struct ksmbd_work *work) in smb2_cancel() argument
6697 struct ksmbd_conn *conn = work->conn; in smb2_cancel()
6698 struct smb2_hdr *hdr = smb2_get_msg(work->request_buf); in smb2_cancel()
6703 if (work->next_smb2_rcv_hdr_off) in smb2_cancel()
6704 hdr = ksmbd_resp_buf_next(work); in smb2_cancel()
6739 iter == work) in smb2_cancel()
6753 work->send_no_response = 1; in smb2_cancel()
6863 int smb2_lock(struct ksmbd_work *work) in smb2_lock() argument
6883 WORK_BUFFERS(work, req, rsp); in smb2_lock()
6886 fp = ksmbd_lookup_fd_slow(work, req->VolatileFileId, req->PersistentFileId); in smb2_lock()
7099 rc = setup_async_work(work, in smb2_lock()
7108 list_add(&work->fp_entry, &fp->blocked_works); in smb2_lock()
7111 smb2_send_interim_resp(work, STATUS_PENDING); in smb2_lock()
7116 list_del(&work->fp_entry); in smb2_lock()
7119 if (work->state != KSMBD_WORK_ACTIVE) { in smb2_lock()
7123 if (work->state == KSMBD_WORK_CANCELLED) { in smb2_lock()
7127 smb2_send_interim_resp(work, in smb2_lock()
7129 work->send_no_response = 1; in smb2_lock()
7140 release_async_work(work); in smb2_lock()
7144 spin_lock(&work->conn->llist_lock); in smb2_lock()
7146 &work->conn->lock_list); in smb2_lock()
7149 spin_unlock(&work->conn->llist_lock); in smb2_lock()
7158 smb_break_all_oplock(work, fp); in smb2_lock()
7164 err = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_lock_rsp)); in smb2_lock()
7168 ksmbd_fd_put(work, fp); in smb2_lock()
7191 spin_lock(&work->conn->llist_lock); in smb2_lock()
7195 spin_unlock(&work->conn->llist_lock); in smb2_lock()
7215 smb2_set_err_rsp(work); in smb2_lock()
7216 ksmbd_fd_put(work, fp); in smb2_lock()
7220 static int fsctl_copychunk(struct ksmbd_work *work, in fsctl_copychunk() argument
7274 src_fp = ksmbd_lookup_foreign_fd(work, in fsctl_copychunk()
7276 dst_fp = ksmbd_lookup_fd_slow(work, volatile_id, persistent_id); in fsctl_copychunk()
7299 ret = ksmbd_vfs_copy_file_ranges(work, src_fp, dst_fp, in fsctl_copychunk()
7327 ksmbd_fd_put(work, src_fp); in fsctl_copychunk()
7328 ksmbd_fd_put(work, dst_fp); in fsctl_copychunk()
7500 static int fsctl_query_allocated_ranges(struct ksmbd_work *work, u64 id, in fsctl_query_allocated_ranges() argument
7519 fp = ksmbd_lookup_fd_fast(work, id); in fsctl_query_allocated_ranges()
7528 ksmbd_fd_put(work, fp); in fsctl_query_allocated_ranges()
7532 static int fsctl_pipe_transceive(struct ksmbd_work *work, u64 id, in fsctl_pipe_transceive() argument
7541 rpc_resp = ksmbd_rpc_ioctl(work->sess, id, data_buf, in fsctl_pipe_transceive()
7577 static inline int fsctl_set_sparse(struct ksmbd_work *work, u64 id, in fsctl_set_sparse() argument
7585 fp = ksmbd_lookup_fd_fast(work, id); in fsctl_set_sparse()
7597 test_share_config_flag(work->tcon->share_conf, in fsctl_set_sparse()
7615 ksmbd_fd_put(work, fp); in fsctl_set_sparse()
7619 static int fsctl_request_resume_key(struct ksmbd_work *work, in fsctl_request_resume_key() argument
7625 fp = ksmbd_lookup_fd_slow(work, req->VolatileFileId, req->PersistentFileId); in fsctl_request_resume_key()
7632 ksmbd_fd_put(work, fp); in fsctl_request_resume_key()
7643 int smb2_ioctl(struct ksmbd_work *work) in smb2_ioctl() argument
7649 struct ksmbd_conn *conn = work->conn; in smb2_ioctl()
7652 if (work->next_smb2_rcv_hdr_off) { in smb2_ioctl()
7653 req = ksmbd_req_buf_next(work); in smb2_ioctl()
7654 rsp = ksmbd_resp_buf_next(work); in smb2_ioctl()
7657 work->compound_fid); in smb2_ioctl()
7658 id = work->compound_fid; in smb2_ioctl()
7661 req = smb2_get_msg(work->request_buf); in smb2_ioctl()
7662 rsp = smb2_get_msg(work->response_buf); in smb2_ioctl()
7674 ret = smb2_calc_max_out_buf_len(work, 48, in smb2_ioctl()
7710 nbytes = fsctl_pipe_transceive(work, id, out_buf_len, req, rsp); in smb2_ioctl()
7752 ret = fsctl_request_resume_key(work, req, in smb2_ioctl()
7762 if (!test_tree_conn_flag(work->tcon, KSMBD_TREE_CONN_FLAG_WRITABLE)) { in smb2_ioctl()
7782 fsctl_copychunk(work, in smb2_ioctl()
7796 ret = fsctl_set_sparse(work, id, in smb2_ioctl()
7807 if (!test_tree_conn_flag(work->tcon, KSMBD_TREE_CONN_FLAG_WRITABLE)) { in smb2_ioctl()
7831 fp = ksmbd_lookup_fd_fast(work, id); in smb2_ioctl()
7837 ret = ksmbd_vfs_zero_data(work, fp, off, len); in smb2_ioctl()
7838 ksmbd_fd_put(work, fp); in smb2_ioctl()
7850 ret = fsctl_query_allocated_ranges(work, id, in smb2_ioctl()
7870 fp = ksmbd_lookup_fd_fast(work, id); in smb2_ioctl()
7880 ksmbd_fd_put(work, fp); in smb2_ioctl()
7897 fp_in = ksmbd_lookup_fd_slow(work, dup_ext->VolatileFileHandle, in smb2_ioctl()
7905 fp_out = ksmbd_lookup_fd_fast(work, id); in smb2_ioctl()
7942 ksmbd_fd_put(work, fp_in); in smb2_ioctl()
7943 ksmbd_fd_put(work, fp_out); in smb2_ioctl()
7964 ret = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_ioctl_rsp) + nbytes); in smb2_ioctl()
7979 smb2_set_err_rsp(work); in smb2_ioctl()
7989 static void smb20_oplock_break_ack(struct ksmbd_work *work) in smb20_oplock_break_ack() argument
8001 WORK_BUFFERS(work, req, rsp); in smb20_oplock_break_ack()
8009 fp = ksmbd_lookup_fd_slow(work, volatile_id, persistent_id); in smb20_oplock_break_ack()
8012 smb2_set_err_rsp(work); in smb20_oplock_break_ack()
8020 smb2_set_err_rsp(work); in smb20_oplock_break_ack()
8021 ksmbd_fd_put(work, fp); in smb20_oplock_break_ack()
8093 ksmbd_fd_put(work, fp); in smb20_oplock_break_ack()
8101 ret = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_oplock_break)); in smb20_oplock_break_ack()
8110 ksmbd_fd_put(work, fp); in smb20_oplock_break_ack()
8111 smb2_set_err_rsp(work); in smb20_oplock_break_ack()
8135 static void smb21_lease_break_ack(struct ksmbd_work *work) in smb21_lease_break_ack() argument
8137 struct ksmbd_conn *conn = work->conn; in smb21_lease_break_ack()
8147 WORK_BUFFERS(work, req, rsp); in smb21_lease_break_ack()
8154 smb2_set_err_rsp(work); in smb21_lease_break_ack()
8253 ret = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_lease_ack)); in smb21_lease_break_ack()
8263 smb2_set_err_rsp(work); in smb21_lease_break_ack()
8272 int smb2_oplock_break(struct ksmbd_work *work) in smb2_oplock_break() argument
8277 WORK_BUFFERS(work, req, rsp); in smb2_oplock_break()
8281 smb20_oplock_break_ack(work); in smb2_oplock_break()
8284 smb21_lease_break_ack(work); in smb2_oplock_break()
8290 smb2_set_err_rsp(work); in smb2_oplock_break()
8302 int smb2_notify(struct ksmbd_work *work) in smb2_notify() argument
8307 WORK_BUFFERS(work, req, rsp); in smb2_notify()
8309 if (work->next_smb2_rcv_hdr_off && req->hdr.NextCommand) { in smb2_notify()
8311 smb2_set_err_rsp(work); in smb2_notify()
8315 smb2_set_err_rsp(work); in smb2_notify()
8327 bool smb2_is_sign_req(struct ksmbd_work *work, unsigned int command) in smb2_is_sign_req() argument
8329 struct smb2_hdr *rcv_hdr2 = smb2_get_msg(work->request_buf); in smb2_is_sign_req()
8346 int smb2_check_sign_req(struct ksmbd_work *work) in smb2_check_sign_req() argument
8354 hdr = smb2_get_msg(work->request_buf); in smb2_check_sign_req()
8355 if (work->next_smb2_rcv_hdr_off) in smb2_check_sign_req()
8356 hdr = ksmbd_req_buf_next(work); in smb2_check_sign_req()
8358 if (!hdr->NextCommand && !work->next_smb2_rcv_hdr_off) in smb2_check_sign_req()
8359 len = get_rfc1002_len(work->request_buf); in smb2_check_sign_req()
8363 len = get_rfc1002_len(work->request_buf) - in smb2_check_sign_req()
8364 work->next_smb2_rcv_hdr_off; in smb2_check_sign_req()
8372 if (ksmbd_sign_smb2_pdu(work->conn, work->sess->sess_key, iov, 1, in smb2_check_sign_req()
8389 void smb2_set_sign_rsp(struct ksmbd_work *work) in smb2_set_sign_rsp() argument
8396 hdr = ksmbd_resp_buf_curr(work); in smb2_set_sign_rsp()
8401 iov = &work->iov[work->iov_idx - 1]; in smb2_set_sign_rsp()
8404 iov = &work->iov[work->iov_idx]; in smb2_set_sign_rsp()
8407 if (!ksmbd_sign_smb2_pdu(work->conn, work->sess->sess_key, iov, n_vec, in smb2_set_sign_rsp()
8418 int smb3_check_sign_req(struct ksmbd_work *work) in smb3_check_sign_req() argument
8420 struct ksmbd_conn *conn = work->conn; in smb3_check_sign_req()
8429 hdr = smb2_get_msg(work->request_buf); in smb3_check_sign_req()
8430 if (work->next_smb2_rcv_hdr_off) in smb3_check_sign_req()
8431 hdr = ksmbd_req_buf_next(work); in smb3_check_sign_req()
8433 if (!hdr->NextCommand && !work->next_smb2_rcv_hdr_off) in smb3_check_sign_req()
8434 len = get_rfc1002_len(work->request_buf); in smb3_check_sign_req()
8438 len = get_rfc1002_len(work->request_buf) - in smb3_check_sign_req()
8439 work->next_smb2_rcv_hdr_off; in smb3_check_sign_req()
8442 signing_key = work->sess->smb3signingkey; in smb3_check_sign_req()
8444 chann = lookup_chann_list(work->sess, conn); in smb3_check_sign_req()
8477 void smb3_set_sign_rsp(struct ksmbd_work *work) in smb3_set_sign_rsp() argument
8479 struct ksmbd_conn *conn = work->conn; in smb3_set_sign_rsp()
8487 hdr = ksmbd_resp_buf_curr(work); in smb3_set_sign_rsp()
8491 signing_key = work->sess->smb3signingkey; in smb3_set_sign_rsp()
8493 chann = lookup_chann_list(work->sess, work->conn); in smb3_set_sign_rsp()
8507 iov = &work->iov[work->iov_idx - 1]; in smb3_set_sign_rsp()
8510 iov = &work->iov[work->iov_idx]; in smb3_set_sign_rsp()
8523 void smb3_preauth_hash_rsp(struct ksmbd_work *work) in smb3_preauth_hash_rsp() argument
8525 struct ksmbd_conn *conn = work->conn; in smb3_preauth_hash_rsp()
8526 struct ksmbd_session *sess = work->sess; in smb3_preauth_hash_rsp()
8532 WORK_BUFFERS(work, req, rsp); in smb3_preauth_hash_rsp()
8536 ksmbd_gen_preauth_integrity_hash(conn, work->response_buf, in smb3_preauth_hash_rsp()
8554 ksmbd_gen_preauth_integrity_hash(conn, work->response_buf, in smb3_preauth_hash_rsp()
8579 int smb3_encrypt_resp(struct ksmbd_work *work) in smb3_encrypt_resp() argument
8581 struct kvec *iov = work->iov; in smb3_encrypt_resp()
8590 fill_transform_hdr(tr_buf, work->response_buf, work->conn->cipher_type); in smb3_encrypt_resp()
8594 work->tr_buf = tr_buf; in smb3_encrypt_resp()
8596 return ksmbd_crypt_message(work, iov, work->iov_idx + 1, 1); in smb3_encrypt_resp()
8606 int smb3_decrypt_req(struct ksmbd_work *work) in smb3_decrypt_req() argument
8609 char *buf = work->request_buf; in smb3_decrypt_req()
8628 sess = ksmbd_session_lookup_all(work->conn, le64_to_cpu(tr_hdr->SessionId)); in smb3_decrypt_req()
8639 rc = ksmbd_crypt_message(work, iov, 2, 0); in smb3_decrypt_req()
8649 bool smb3_11_final_sess_setup_resp(struct ksmbd_work *work) in smb3_11_final_sess_setup_resp() argument
8651 struct ksmbd_conn *conn = work->conn; in smb3_11_final_sess_setup_resp()
8652 struct ksmbd_session *sess = work->sess; in smb3_11_final_sess_setup_resp()
8653 struct smb2_hdr *rsp = smb2_get_msg(work->response_buf); in smb3_11_final_sess_setup_resp()
8658 if (work->next_smb2_rcv_hdr_off) in smb3_11_final_sess_setup_resp()
8659 rsp = ksmbd_resp_buf_next(work); in smb3_11_final_sess_setup_resp()