Lines Matching refs:rsp

42 static void __wbuf(struct ksmbd_work *work, void **req, void **rsp)
46 *rsp = ksmbd_resp_buf_next(work);
49 *rsp = smb2_get_msg(work->response_buf);
253 struct smb2_negotiate_rsp *rsp;
271 rsp = smb2_get_msg(work->response_buf);
275 rsp->StructureSize = cpu_to_le16(65);
277 rsp->DialectRevision = cpu_to_le16(conn->dialect);
278 /* Not setting conn guid rsp->ServerGUID, as it
281 rsp->Capabilities = cpu_to_le32(conn->vals->capabilities);
283 rsp->MaxTransactSize = cpu_to_le32(conn->vals->max_trans_size);
284 rsp->MaxReadSize = cpu_to_le32(conn->vals->max_read_size);
285 rsp->MaxWriteSize = cpu_to_le32(conn->vals->max_write_size);
287 rsp->SystemTime = cpu_to_le64(ksmbd_systime());
288 rsp->ServerStartTime = 0;
290 rsp->SecurityBufferOffset = cpu_to_le16(128);
291 rsp->SecurityBufferLength = cpu_to_le16(AUTH_GSS_LENGTH);
292 ksmbd_copy_gss_neg_header((char *)(&rsp->hdr) +
293 le16_to_cpu(rsp->SecurityBufferOffset));
294 rsp->SecurityMode = SMB2_NEGOTIATE_SIGNING_ENABLED_LE;
296 rsp->SecurityMode |= SMB2_NEGOTIATE_SIGNING_REQUIRED_LE;
297 err = ksmbd_iov_pin_rsp(work, rsp,
376 struct smb2_hdr *rsp = ksmbd_resp_buf_next(work);
383 * in the compound rsp
389 if (req->Command == SMB2_CREATE && rsp->Status == STATUS_SUCCESS) {
390 work->compound_fid = ((struct smb2_create_rsp *)rsp)->VolatileFileId;
391 work->compound_pfid = ((struct smb2_create_rsp *)rsp)->PersistentFileId;
392 work->compound_sid = le64_to_cpu(rsp->SessionId);
401 rsp->NextCommand = cpu_to_le32(new_len);
407 "Compound req new_len = %d rcv off = %d rsp off = %d\n",
835 struct smb2_negotiate_rsp *rsp)
837 char * const pneg_ctxt = (char *)rsp +
838 le32_to_cpu(rsp->NegotiateContextOffset);
884 rsp->NegotiateContextCount = cpu_to_le16(neg_ctxt_cnt);
1099 struct smb2_negotiate_rsp *rsp = smb2_get_msg(work->response_buf);
1115 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
1122 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
1131 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
1137 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
1144 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
1151 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
1165 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
1174 rsp->hdr.Status = status;
1183 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
1192 rsp->NegotiateContextOffset =
1194 neg_ctxt_len = assemble_neg_contexts(conn, rsp);
1210 rsp->hdr.Status = STATUS_NOT_SUPPORTED;
1214 rsp->Capabilities = cpu_to_le32(conn->vals->capabilities);
1219 rsp->MaxTransactSize = cpu_to_le32(conn->vals->max_trans_size);
1220 rsp->MaxReadSize = cpu_to_le32(conn->vals->max_read_size);
1221 rsp->MaxWriteSize = cpu_to_le32(conn->vals->max_write_size);
1227 rsp->StructureSize = cpu_to_le16(65);
1228 rsp->DialectRevision = cpu_to_le16(conn->dialect);
1229 /* Not setting conn guid rsp->ServerGUID, as it
1232 memset(rsp->ServerGUID, 0, SMB2_CLIENT_GUID_SIZE);
1234 rsp->SystemTime = cpu_to_le64(ksmbd_systime());
1235 rsp->ServerStartTime = 0;
1237 le32_to_cpu(rsp->NegotiateContextOffset),
1238 le16_to_cpu(rsp->NegotiateContextCount));
1240 rsp->SecurityBufferOffset = cpu_to_le16(128);
1241 rsp->SecurityBufferLength = cpu_to_le16(AUTH_GSS_LENGTH);
1242 ksmbd_copy_gss_neg_header((char *)(&rsp->hdr) +
1243 le16_to_cpu(rsp->SecurityBufferOffset));
1245 rsp->SecurityMode = SMB2_NEGOTIATE_SIGNING_ENABLED_LE;
1254 rsp->SecurityMode |= SMB2_NEGOTIATE_SIGNING_REQUIRED_LE;
1258 conn->srv_sec_mode = le16_to_cpu(rsp->SecurityMode);
1263 rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
1266 rc = ksmbd_iov_pin_rsp(work, rsp,
1338 size_t negblob_len, struct smb2_sess_setup_rsp *rsp)
1351 sz = le16_to_cpu(rsp->SecurityBufferOffset);
1353 (struct challenge_message *)((char *)&rsp->hdr.ProtocolId + sz);
1361 rsp->SecurityBufferLength = cpu_to_le16(sz);
1386 sz = le16_to_cpu(rsp->SecurityBufferOffset);
1387 memcpy((char *)&rsp->hdr.ProtocolId + sz, spnego_blob, spnego_blob_len);
1388 rsp->SecurityBufferLength = cpu_to_le16(spnego_blob_len);
1449 struct smb2_sess_setup_rsp *rsp)
1469 sz = le16_to_cpu(rsp->SecurityBufferOffset);
1470 memcpy((char *)&rsp->hdr.ProtocolId + sz, spnego_blob, spnego_blob_len);
1471 rsp->SecurityBufferLength = cpu_to_le16(spnego_blob_len);
1506 rsp->SessionFlags = SMB2_SESSION_FLAG_IS_GUEST_LE;
1534 if ((rsp->SessionFlags != SMB2_SESSION_FLAG_IS_GUEST_LE &&
1549 rsp->SessionFlags = SMB2_SESSION_FLAG_ENCRYPT_DATA_LE;
1588 struct smb2_sess_setup_rsp *rsp)
1601 out_blob = (char *)&rsp->hdr.ProtocolId +
1602 le16_to_cpu(rsp->SecurityBufferOffset);
1604 (le16_to_cpu(rsp->SecurityBufferOffset) + 4);
1620 rsp->SecurityBufferLength = cpu_to_le16(out_len);
1635 rsp->SessionFlags = SMB2_SESSION_FLAG_ENCRYPT_DATA_LE;
1668 struct smb2_sess_setup_rsp *rsp)
1678 struct smb2_sess_setup_rsp *rsp;
1686 WORK_BUFFERS(work, req, rsp);
1688 rsp->StructureSize = cpu_to_le16(9);
1689 rsp->SessionFlags = 0;
1690 rsp->SecurityBufferOffset = cpu_to_le16(72);
1691 rsp->SecurityBufferLength = 0;
1700 rsp->hdr.SessionId = cpu_to_le64(sess->id);
1814 rc = krb5_authenticate(work, req, rsp);
1828 rc = ntlm_negotiate(work, negblob, negblob_len, rsp);
1831 rsp->hdr.Status =
1834 rc = ntlm_authenticate(work, req, rsp);
1871 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
1873 rsp->hdr.Status = STATUS_USER_SESSION_DELETED;
1875 rsp->hdr.Status = STATUS_REQUEST_NOT_ACCEPTED;
1877 rsp->hdr.Status = STATUS_NETWORK_SESSION_EXPIRED;
1879 rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
1881 rsp->hdr.Status = STATUS_NOT_SUPPORTED;
1883 rsp->hdr.Status = STATUS_LOGON_FAILURE;
1895 rsp->SecurityBufferOffset = 0;
1921 if (rsp->SecurityBufferLength)
1923 le16_to_cpu(rsp->SecurityBufferLength);
1926 rc = ksmbd_iov_pin_rsp(work, rsp, iov_len);
1928 rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
1945 struct smb2_tree_connect_rsp *rsp;
1952 WORK_BUFFERS(work, req, rsp);
1974 rsp->hdr.Id.SyncId.TreeId = cpu_to_le32(status.tree_conn->id);
1981 rsp->ShareType = SMB2_SHARE_TYPE_PIPE;
1982 rsp->MaximalAccess = FILE_READ_DATA_LE | FILE_READ_EA_LE |
1988 rsp->ShareType = SMB2_SHARE_TYPE_DISK;
1989 rsp->MaximalAccess = FILE_READ_DATA_LE | FILE_READ_EA_LE |
1993 rsp->MaximalAccess |= FILE_WRITE_DATA_LE |
2002 status.tree_conn->maximal_access = le32_to_cpu(rsp->MaximalAccess);
2009 rsp->StructureSize = cpu_to_le16(16);
2011 rsp->Capabilities = 0;
2012 rsp->Reserved = 0;
2014 rsp->ShareFlags = SMB2_SHAREFLAG_MANUAL_CACHING;
2016 rc = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_tree_connect_rsp));
2027 rsp->hdr.Status = STATUS_SUCCESS;
2033 rsp->hdr.Status = STATUS_BAD_NETWORK_NAME;
2037 rsp->hdr.Status = STATUS_NO_MEMORY;
2042 rsp->hdr.Status = STATUS_ACCESS_DENIED;
2045 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
2048 rsp->hdr.Status = STATUS_ACCESS_DENIED;
2128 struct smb2_tree_disconnect_rsp *rsp;
2134 WORK_BUFFERS(work, req, rsp);
2141 rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED;
2151 rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED;
2162 rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED;
2168 rsp->StructureSize = cpu_to_le16(4);
2169 err = ksmbd_iov_pin_rsp(work, rsp,
2172 rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
2194 struct smb2_logoff_rsp *rsp;
2199 WORK_BUFFERS(work, req, rsp);
2206 rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED;
2224 rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED;
2236 rsp->StructureSize = cpu_to_le16(4);
2237 err = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_logoff_rsp));
2239 rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
2254 struct smb2_create_rsp *rsp;
2260 WORK_BUFFERS(work, req, rsp);
2265 rsp->hdr.Status = STATUS_NO_MEMORY;
2277 rsp->hdr.Status = STATUS_SUCCESS;
2278 rsp->StructureSize = cpu_to_le16(89);
2279 rsp->OplockLevel = SMB2_OPLOCK_LEVEL_NONE;
2280 rsp->Flags = 0;
2281 rsp->CreateAction = cpu_to_le32(FILE_OPENED);
2283 rsp->CreationTime = cpu_to_le64(0);
2284 rsp->LastAccessTime = cpu_to_le64(0);
2285 rsp->ChangeTime = cpu_to_le64(0);
2286 rsp->AllocationSize = cpu_to_le64(0);
2287 rsp->EndofFile = cpu_to_le64(0);
2288 rsp->FileAttributes = FILE_ATTRIBUTE_NORMAL_LE;
2289 rsp->Reserved2 = 0;
2290 rsp->VolatileFileId = id;
2291 rsp->PersistentFileId = 0;
2292 rsp->CreateContextsOffset = 0;
2293 rsp->CreateContextsLength = 0;
2295 err = ksmbd_iov_pin_rsp(work, rsp, offsetof(struct smb2_create_rsp, Buffer));
2305 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
2309 rsp->hdr.Status = STATUS_NO_MEMORY;
2657 struct smb2_create_rsp *rsp;
2684 WORK_BUFFERS(work, req, rsp);
2689 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
2752 rsp->hdr.Status = STATUS_BAD_IMPERSONATION_LEVEL;
2820 rsp->hdr.Status = STATUS_ACCESS_DENIED;
2917 rsp->hdr.Status = STATUS_NOT_A_DIRECTORY;
2923 rsp->hdr.Status = STATUS_FILE_IS_A_DIRECTORY;
2929 rsp->hdr.Status = STATUS_NOT_A_DIRECTORY;
2942 rsp->hdr.Status = STATUS_FILE_IS_A_DIRECTORY;
2950 rsp->hdr.Status = STATUS_NOT_A_DIRECTORY;
3003 rsp->hdr.Status = STATUS_OBJECT_PATH_NOT_FOUND;
3320 rsp->StructureSize = cpu_to_le16(89);
3323 rsp->OplockLevel = opinfo != NULL ? opinfo->level : 0;
3325 rsp->Flags = 0;
3326 rsp->CreateAction = cpu_to_le32(file_info);
3327 rsp->CreationTime = cpu_to_le64(fp->create_time);
3329 rsp->LastAccessTime = cpu_to_le64(time);
3331 rsp->LastWriteTime = cpu_to_le64(time);
3333 rsp->ChangeTime = cpu_to_le64(time);
3334 rsp->AllocationSize = S_ISDIR(stat.mode) ? 0 :
3336 rsp->EndofFile = S_ISDIR(stat.mode) ? 0 : cpu_to_le64(stat.size);
3337 rsp->FileAttributes = fp->f_ci->m_fattr;
3339 rsp->Reserved2 = 0;
3341 rsp->PersistentFileId = fp->persistent_id;
3342 rsp->VolatileFileId = fp->volatile_id;
3344 rsp->CreateContextsOffset = 0;
3345 rsp->CreateContextsLength = 0;
3354 rsp->OplockLevel = SMB2_OPLOCK_LEVEL_LEASE;
3356 lease_ccontext = (struct create_context *)rsp->Buffer;
3358 create_lease_buf(rsp->Buffer, opinfo->o_lease);
3359 le32_add_cpu(&rsp->CreateContextsLength,
3373 mxac_ccontext = (struct create_context *)(rsp->Buffer +
3374 le32_to_cpu(rsp->CreateContextsLength));
3376 create_mxac_rsp_buf(rsp->Buffer +
3377 le32_to_cpu(rsp->CreateContextsLength),
3379 le32_add_cpu(&rsp->CreateContextsLength,
3391 disk_id_ccontext = (struct create_context *)(rsp->Buffer +
3392 le32_to_cpu(rsp->CreateContextsLength));
3394 create_disk_id_rsp_buf(rsp->Buffer +
3395 le32_to_cpu(rsp->CreateContextsLength),
3397 le32_add_cpu(&rsp->CreateContextsLength,
3408 create_posix_rsp_buf(rsp->Buffer +
3409 le32_to_cpu(rsp->CreateContextsLength),
3411 le32_add_cpu(&rsp->CreateContextsLength,
3419 rsp->CreateContextsOffset =
3433 rc = ksmbd_iov_pin_rsp(work, (void *)rsp, iov_len);
3437 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
3439 rsp->hdr.Status = STATUS_NOT_SUPPORTED;
3441 rsp->hdr.Status = STATUS_ACCESS_DENIED;
3443 rsp->hdr.Status = STATUS_OBJECT_NAME_INVALID;
3445 rsp->hdr.Status = STATUS_SHARING_VIOLATION;
3447 rsp->hdr.Status = STATUS_DELETE_PENDING;
3449 rsp->hdr.Status = STATUS_OBJECT_NAME_NOT_FOUND;
3451 rsp->hdr.Status = STATUS_DUPLICATE_OBJECTID;
3453 rsp->hdr.Status = STATUS_NO_SUCH_DEVICE;
3455 rsp->hdr.Status = STATUS_OBJECT_NAME_COLLISION;
3457 rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
3458 if (!rsp->hdr.Status)
3459 rsp->hdr.Status = STATUS_UNEXPECTED_IO_ERROR;
3464 ksmbd_debug(SMB, "Error response: %x\n", rsp->hdr.Status);
4032 struct smb2_query_directory_rsp *rsp;
4042 WORK_BUFFERS(work, req, rsp);
4045 rsp->hdr.Status = STATUS_NO_MEMORY;
4095 d_info.wptr = (char *)rsp->Buffer;
4096 d_info.rptr = (char *)rsp->Buffer;
4151 rsp->hdr.Status = STATUS_NO_SUCH_FILE;
4154 rsp->hdr.Status = STATUS_NO_MORE_FILES;
4156 rsp->StructureSize = cpu_to_le16(9);
4157 rsp->OutputBufferOffset = cpu_to_le16(0);
4158 rsp->OutputBufferLength = cpu_to_le32(0);
4159 rsp->Buffer[0] = 0;
4160 rc = ksmbd_iov_pin_rsp(work, (void *)rsp,
4167 ((char *)rsp->Buffer + d_info.last_entry_offset))
4172 rsp->StructureSize = cpu_to_le16(9);
4173 rsp->OutputBufferOffset = cpu_to_le16(72);
4174 rsp->OutputBufferLength = cpu_to_le32(d_info.data_count);
4175 rc = ksmbd_iov_pin_rsp(work, (void *)rsp,
4193 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
4195 rsp->hdr.Status = STATUS_ACCESS_DENIED;
4197 rsp->hdr.Status = STATUS_NO_SUCH_FILE;
4199 rsp->hdr.Status = STATUS_FILE_CLOSED;
4201 rsp->hdr.Status = STATUS_NO_MEMORY;
4203 rsp->hdr.Status = STATUS_INVALID_INFO_CLASS;
4205 rsp->hdr.Status = STATUS_FILE_CORRUPT_ERROR;
4206 if (!rsp->hdr.Status)
4207 rsp->hdr.Status = STATUS_UNEXPECTED_IO_ERROR;
4218 * @rsp: query info response buffer contains output buffer length
4224 struct smb2_query_info_rsp *rsp,
4227 if (reqOutputBufferLength < le32_to_cpu(rsp->OutputBufferLength)) {
4229 rsp->hdr.Status = STATUS_INFO_LENGTH_MISMATCH;
4236 static void get_standard_info_pipe(struct smb2_query_info_rsp *rsp,
4241 sinfo = (struct smb2_file_standard_info *)rsp->Buffer;
4248 rsp->OutputBufferLength =
4252 static void get_internal_info_pipe(struct smb2_query_info_rsp *rsp, u64 num,
4257 file_info = (struct smb2_file_internal_info *)rsp->Buffer;
4261 rsp->OutputBufferLength =
4267 struct smb2_query_info_rsp *rsp,
4286 get_standard_info_pipe(rsp, rsp_org);
4288 rsp, rsp_org);
4291 get_internal_info_pipe(rsp, id, rsp_org);
4293 rsp, rsp_org);
4308 * @rsp: response buffer pointer
4315 struct smb2_query_info_rsp *rsp, void *rsp_org)
4343 "All EAs are requested but need to send single EA entry in rsp flags 0x%x\n",
4355 rsp->hdr.Status = STATUS_INVALID_HANDLE;
4363 ptr = (char *)rsp->Buffer;
4407 rsp->hdr.Status = STATUS_INVALID_HANDLE;
4459 rsp->hdr.Status = STATUS_NO_EAS_ON_FILE;
4460 rsp->OutputBufferLength = cpu_to_le32(rsp_data_cnt);
4466 static void get_file_access_info(struct smb2_query_info_rsp *rsp,
4471 file_info = (struct smb2_file_access_info *)rsp->Buffer;
4473 rsp->OutputBufferLength =
4477 static int get_file_basic_info(struct smb2_query_info_rsp *rsp,
4490 basic_info = (struct smb2_file_basic_info *)rsp->Buffer;
4502 rsp->OutputBufferLength =
4507 static void get_file_standard_info(struct smb2_query_info_rsp *rsp,
4518 sinfo = (struct smb2_file_standard_info *)rsp->Buffer;
4526 rsp->OutputBufferLength =
4530 static void get_file_alignment_info(struct smb2_query_info_rsp *rsp,
4535 file_info = (struct smb2_file_alignment_info *)rsp->Buffer;
4537 rsp->OutputBufferLength =
4542 struct smb2_query_info_rsp *rsp,
4570 file_info = (struct smb2_file_all_info *)rsp->Buffer;
4599 rsp->OutputBufferLength =
4606 struct smb2_query_info_rsp *rsp,
4616 file_info = (struct smb2_file_alt_name_info *)rsp->Buffer;
4622 rsp->OutputBufferLength =
4627 struct smb2_query_info_rsp *rsp,
4643 file_info = (struct smb2_file_stream_info *)rsp->Buffer;
4689 file_info = (struct smb2_file_stream_info *)&rsp->Buffer[nbytes];
4708 &rsp->Buffer[nbytes];
4722 rsp->OutputBufferLength = cpu_to_le32(nbytes);
4725 static void get_file_internal_info(struct smb2_query_info_rsp *rsp,
4733 file_info = (struct smb2_file_internal_info *)rsp->Buffer;
4735 rsp->OutputBufferLength =
4739 static int get_file_network_open_info(struct smb2_query_info_rsp *rsp,
4753 file_info = (struct smb2_file_ntwrk_info *)rsp->Buffer;
4770 rsp->OutputBufferLength =
4775 static void get_file_ea_info(struct smb2_query_info_rsp *rsp, void *rsp_org)
4779 file_info = (struct smb2_file_ea_info *)rsp->Buffer;
4781 rsp->OutputBufferLength =
4785 static void get_file_position_info(struct smb2_query_info_rsp *rsp,
4790 file_info = (struct smb2_file_pos_info *)rsp->Buffer;
4792 rsp->OutputBufferLength =
4796 static void get_file_mode_info(struct smb2_query_info_rsp *rsp,
4801 file_info = (struct smb2_file_mode_info *)rsp->Buffer;
4803 rsp->OutputBufferLength =
4807 static void get_file_compression_info(struct smb2_query_info_rsp *rsp,
4816 file_info = (struct smb2_file_comp_info *)rsp->Buffer;
4824 rsp->OutputBufferLength =
4828 static int get_file_attribute_tag_info(struct smb2_query_info_rsp *rsp,
4839 file_info = (struct smb2_file_attr_tag_info *)rsp->Buffer;
4842 rsp->OutputBufferLength =
4847 static void find_file_posix_info(struct smb2_query_info_rsp *rsp,
4858 file_info = (struct smb311_posix_qinfo *)rsp->Buffer;
4884 rsp->OutputBufferLength = cpu_to_le32(out_buf_len);
4889 struct smb2_query_info_rsp *rsp)
4899 return smb2_get_info_file_pipe(work->sess, req, rsp,
4925 get_file_access_info(rsp, fp, work->response_buf);
4929 rc = get_file_basic_info(rsp, fp, work->response_buf);
4933 get_file_standard_info(rsp, fp, work->response_buf);
4937 get_file_alignment_info(rsp, work->response_buf);
4941 rc = get_file_all_info(work, rsp, fp, work->response_buf);
4945 get_file_alternate_info(work, rsp, fp, work->response_buf);
4949 get_file_stream_info(work, rsp, fp, work->response_buf);
4953 get_file_internal_info(rsp, fp, work->response_buf);
4957 rc = get_file_network_open_info(rsp, fp, work->response_buf);
4961 get_file_ea_info(rsp, work->response_buf);
4965 rc = smb2_get_ea(work, fp, req, rsp, work->response_buf);
4969 get_file_position_info(rsp, fp, work->response_buf);
4973 get_file_mode_info(rsp, fp, work->response_buf);
4977 get_file_compression_info(rsp, fp, work->response_buf);
4981 rc = get_file_attribute_tag_info(rsp, fp, work->response_buf);
4988 find_file_posix_info(rsp, fp, work->response_buf);
4998 rsp, work->response_buf);
5005 struct smb2_query_info_rsp *rsp)
5038 info = (struct filesystem_device_info *)rsp->Buffer;
5042 rsp->OutputBufferLength = cpu_to_le32(8);
5050 info = (struct filesystem_attribute_info *)rsp->Buffer;
5070 rsp->OutputBufferLength = cpu_to_le32(sz);
5079 info = (struct filesystem_vol_info *)(rsp->Buffer);
5096 rsp->OutputBufferLength = cpu_to_le32(sz);
5103 info = (struct filesystem_info *)(rsp->Buffer);
5108 rsp->OutputBufferLength = cpu_to_le32(24);
5115 info = (struct smb2_fs_full_size_info *)(rsp->Buffer);
5123 rsp->OutputBufferLength = cpu_to_le32(32);
5130 info = (struct object_id_info *)(rsp->Buffer);
5142 rsp->OutputBufferLength = cpu_to_le32(64);
5151 info = (struct smb3_fs_ss_info *)(rsp->Buffer);
5163 rsp->OutputBufferLength = cpu_to_le32(28);
5176 info = (struct smb2_fs_control_info *)(rsp->Buffer);
5183 rsp->OutputBufferLength = cpu_to_le32(48);
5194 info = (struct filesystem_posix_info *)(rsp->Buffer);
5202 rsp->OutputBufferLength = cpu_to_le32(56);
5211 rsp, work->response_buf);
5218 struct smb2_query_info_rsp *rsp)
5222 struct smb_ntsd *pntsd = (struct smb_ntsd *)rsp->Buffer, *ppntsd = NULL;
5244 rsp->OutputBufferLength = cpu_to_le32(secdesclen);
5288 rsp->OutputBufferLength = cpu_to_le32(secdesclen);
5301 struct smb2_query_info_rsp *rsp;
5304 WORK_BUFFERS(work, req, rsp);
5311 rc = smb2_get_info_file(work, req, rsp);
5315 rc = smb2_get_info_filesystem(work, req, rsp);
5319 rc = smb2_get_info_sec(work, req, rsp);
5328 rsp->StructureSize = cpu_to_le16(9);
5329 rsp->OutputBufferOffset = cpu_to_le16(72);
5330 rc = ksmbd_iov_pin_rsp(work, (void *)rsp,
5332 le32_to_cpu(rsp->OutputBufferLength));
5337 rsp->hdr.Status = STATUS_ACCESS_DENIED;
5339 rsp->hdr.Status = STATUS_FILE_CLOSED;
5341 rsp->hdr.Status = STATUS_UNEXPECTED_IO_ERROR;
5343 rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
5344 else if (rc == -EOPNOTSUPP || rsp->hdr.Status == 0)
5345 rsp->hdr.Status = STATUS_INVALID_INFO_CLASS;
5365 struct smb2_close_rsp *rsp;
5367 WORK_BUFFERS(work, req, rsp);
5372 rsp->StructureSize = cpu_to_le16(60);
5373 rsp->Flags = 0;
5374 rsp->Reserved = 0;
5375 rsp->CreationTime = 0;
5376 rsp->LastAccessTime = 0;
5377 rsp->LastWriteTime = 0;
5378 rsp->ChangeTime = 0;
5379 rsp->AllocationSize = 0;
5380 rsp->EndOfFile = 0;
5381 rsp->Attributes = 0;
5383 return ksmbd_iov_pin_rsp(work, (void *)rsp,
5398 struct smb2_close_rsp *rsp;
5405 WORK_BUFFERS(work, req, rsp);
5421 rsp->hdr.Status = STATUS_USER_SESSION_DELETED;
5423 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
5433 rsp->hdr.Status = STATUS_FILE_CLOSED;
5452 rsp->StructureSize = cpu_to_le16(60);
5453 rsp->Reserved = 0;
5463 rsp->Flags = SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB;
5464 rsp->AllocationSize = S_ISDIR(inode->i_mode) ? 0 :
5466 rsp->EndOfFile = cpu_to_le64(inode->i_size);
5467 rsp->Attributes = fp->f_ci->m_fattr;
5468 rsp->CreationTime = cpu_to_le64(fp->create_time);
5470 rsp->LastAccessTime = cpu_to_le64(time);
5472 rsp->LastWriteTime = cpu_to_le64(time);
5474 rsp->ChangeTime = cpu_to_le64(time);
5477 rsp->Flags = 0;
5478 rsp->AllocationSize = 0;
5479 rsp->EndOfFile = 0;
5480 rsp->Attributes = 0;
5481 rsp->CreationTime = 0;
5482 rsp->LastAccessTime = 0;
5483 rsp->LastWriteTime = 0;
5484 rsp->ChangeTime = 0;
5490 err = ksmbd_iov_pin_rsp(work, (void *)rsp,
5494 if (rsp->hdr.Status == 0)
5495 rsp->hdr.Status = STATUS_FILE_CLOSED;
5510 struct smb2_echo_rsp *rsp = smb2_get_msg(work->response_buf);
5513 rsp = ksmbd_resp_buf_next(work);
5515 rsp->StructureSize = cpu_to_le16(4);
5516 rsp->Reserved = 0;
5517 return ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_echo_rsp));
6039 struct smb2_set_info_rsp *rsp;
6048 rsp = ksmbd_resp_buf_next(work);
6057 rsp = smb2_get_msg(work->response_buf);
6103 rsp->StructureSize = cpu_to_le16(2);
6104 rc = ksmbd_iov_pin_rsp(work, (void *)rsp,
6113 rsp->hdr.Status = STATUS_ACCESS_DENIED;
6115 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
6117 rsp->hdr.Status = STATUS_SHARING_VIOLATION;
6119 rsp->hdr.Status = STATUS_OBJECT_NAME_INVALID;
6121 rsp->hdr.Status = STATUS_DIRECTORY_NOT_EMPTY;
6123 rsp->hdr.Status = STATUS_FILE_LOCK_CONFLICT;
6125 rsp->hdr.Status = STATUS_INVALID_HANDLE;
6127 rsp->hdr.Status = STATUS_OBJECT_NAME_COLLISION;
6128 else if (rsp->hdr.Status == 0 || rc == -EOPNOTSUPP)
6129 rsp->hdr.Status = STATUS_INVALID_INFO_CLASS;
6148 struct smb2_read_rsp *rsp;
6150 WORK_BUFFERS(work, req, rsp);
6173 err = ksmbd_iov_pin_rsp_read(work, (void *)rsp,
6182 err = ksmbd_iov_pin_rsp(work, (void *)rsp,
6188 rsp->StructureSize = cpu_to_le16(17);
6189 rsp->DataOffset = 80;
6190 rsp->Reserved = 0;
6191 rsp->DataLength = cpu_to_le32(nbytes);
6192 rsp->DataRemaining = 0;
6193 rsp->Flags = 0;
6197 rsp->hdr.Status = STATUS_UNEXPECTED_IO_ERROR;
6259 struct smb2_read_rsp *rsp;
6278 rsp = ksmbd_resp_buf_next(work);
6287 rsp = smb2_get_msg(work->response_buf);
6357 rsp->hdr.Status = STATUS_END_OF_FILE;
6380 rsp->StructureSize = cpu_to_le16(17);
6381 rsp->DataOffset = 80;
6382 rsp->Reserved = 0;
6383 rsp->DataLength = cpu_to_le32(nbytes);
6384 rsp->DataRemaining = cpu_to_le32(remain_bytes);
6385 rsp->Flags = 0;
6386 err = ksmbd_iov_pin_rsp_read(work, (void *)rsp,
6399 rsp->hdr.Status = STATUS_INVALID_DEVICE_REQUEST;
6401 rsp->hdr.Status = STATUS_FILE_LOCK_CONFLICT;
6403 rsp->hdr.Status = STATUS_FILE_CLOSED;
6405 rsp->hdr.Status = STATUS_ACCESS_DENIED;
6407 rsp->hdr.Status = STATUS_SHARING_VIOLATION;
6409 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
6411 rsp->hdr.Status = STATUS_INVALID_HANDLE;
6428 struct smb2_write_rsp *rsp;
6435 WORK_BUFFERS(work, req, rsp);
6455 rsp->hdr.Status = STATUS_NOT_SUPPORTED;
6461 rsp->hdr.Status = STATUS_INVALID_HANDLE;
6469 rsp->StructureSize = cpu_to_le16(17);
6470 rsp->DataOffset = 0;
6471 rsp->Reserved = 0;
6472 rsp->DataLength = cpu_to_le32(length);
6473 rsp->DataRemaining = 0;
6474 rsp->Reserved2 = 0;
6475 err = ksmbd_iov_pin_rsp(work, (void *)rsp,
6479 rsp->hdr.Status = STATUS_INVALID_HANDLE;
6525 struct smb2_write_rsp *rsp;
6535 WORK_BUFFERS(work, req, rsp);
6626 rsp->StructureSize = cpu_to_le16(17);
6627 rsp->DataOffset = 0;
6628 rsp->Reserved = 0;
6629 rsp->DataLength = cpu_to_le32(nbytes);
6630 rsp->DataRemaining = 0;
6631 rsp->Reserved2 = 0;
6632 err = ksmbd_iov_pin_rsp(work, rsp, offsetof(struct smb2_write_rsp, Buffer));
6640 rsp->hdr.Status = STATUS_FILE_LOCK_CONFLICT;
6642 rsp->hdr.Status = STATUS_DISK_FULL;
6644 rsp->hdr.Status = STATUS_FILE_CLOSED;
6646 rsp->hdr.Status = STATUS_ACCESS_DENIED;
6648 rsp->hdr.Status = STATUS_SHARING_VIOLATION;
6650 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
6652 rsp->hdr.Status = STATUS_INVALID_HANDLE;
6668 struct smb2_flush_rsp *rsp;
6671 WORK_BUFFERS(work, req, rsp);
6679 rsp->StructureSize = cpu_to_le16(4);
6680 rsp->Reserved = 0;
6681 return ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_flush_rsp));
6684 rsp->hdr.Status = STATUS_INVALID_HANDLE;
6866 struct smb2_lock_rsp *rsp;
6883 WORK_BUFFERS(work, req, rsp);
6916 rsp->hdr.Status = STATUS_INVALID_LOCK_RANGE;
6936 rsp->hdr.Status = STATUS_INVALID_LOCK_RANGE;
7060 rsp->hdr.Status = STATUS_RANGE_NOT_LOCKED;
7079 rsp->hdr.Status = STATUS_NOT_LOCKED;
7124 rsp->hdr.Status =
7133 rsp->hdr.Status =
7160 rsp->StructureSize = cpu_to_le16(4);
7162 rsp->hdr.Status = STATUS_SUCCESS;
7163 rsp->Reserved = 0;
7164 err = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_lock_rsp));
7204 if (!rsp->hdr.Status) {
7206 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
7208 rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
7210 rsp->hdr.Status = STATUS_FILE_CLOSED;
7212 rsp->hdr.Status = STATUS_LOCK_NOT_GRANTED;
7226 struct smb2_ioctl_rsp *rsp)
7236 ci_rsp = (struct copychunk_ioctl_rsp *)&rsp->Buffer[0];
7238 rsp->VolatileFileId = volatile_id;
7239 rsp->PersistentFileId = persistent_id;
7257 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
7270 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
7280 rsp->hdr.Status = STATUS_OBJECT_NAME_NOT_FOUND;
7285 rsp->hdr.Status = STATUS_FILE_CLOSED;
7295 rsp->hdr.Status = STATUS_ACCESS_DENIED;
7306 rsp->hdr.Status = STATUS_ACCESS_DENIED;
7308 rsp->hdr.Status = STATUS_FILE_LOCK_CONFLICT;
7310 rsp->hdr.Status = STATUS_INVALID_HANDLE;
7312 rsp->hdr.Status = STATUS_DISK_FULL;
7314 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
7316 rsp->hdr.Status = STATUS_FILE_IS_A_DIRECTORY;
7318 rsp->hdr.Status = STATUS_INVALID_VIEW_SIZE;
7320 rsp->hdr.Status = STATUS_UNEXPECTED_IO_ERROR;
7351 struct smb2_ioctl_rsp *rsp,
7379 &rsp->Buffer[nbytes];
7453 rsp->PersistentFileId = SMB2_NO_FID;
7454 rsp->VolatileFileId = SMB2_NO_FID;
7535 struct smb2_ioctl_rsp *rsp)
7549 rsp->hdr.Status = STATUS_SOME_NOT_MAPPED;
7551 rsp->hdr.Status = STATUS_NOT_SUPPORTED;
7554 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
7560 rsp->hdr.Status = STATUS_BUFFER_OVERFLOW;
7565 rsp->hdr.Status =
7570 memcpy((char *)rsp->Buffer, rpc_resp->payload, nbytes);
7646 struct smb2_ioctl_rsp *rsp;
7654 rsp = ksmbd_resp_buf_next(work);
7662 rsp = smb2_get_msg(work->response_buf);
7669 rsp->hdr.Status = STATUS_NOT_SUPPORTED;
7677 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
7687 rsp->hdr.Status = STATUS_FS_DRIVER_REQUIRED;
7695 &rsp->Buffer[0];
7710 nbytes = fsctl_pipe_transceive(work, id, out_buf_len, req, rsp);
7731 (struct validate_negotiate_info_rsp *)&rsp->Buffer[0],
7737 rsp->PersistentFileId = SMB2_NO_FID;
7738 rsp->VolatileFileId = SMB2_NO_FID;
7741 ret = fsctl_query_iface_info_ioctl(conn, rsp, out_buf_len);
7753 (struct resume_key_ioctl_rsp *)&rsp->Buffer[0]);
7756 rsp->PersistentFileId = req->PersistentFileId;
7757 rsp->VolatileFileId = req->VolatileFileId;
7780 rsp->VolatileFileId = req->VolatileFileId;
7781 rsp->PersistentFileId = req->PersistentFileId;
7788 rsp);
7852 (struct file_allocated_range_buffer *)&rsp->Buffer[0],
7856 rsp->hdr.Status = STATUS_BUFFER_OVERFLOW;
7869 reparse_ptr = (struct reparse_data_buffer *)&rsp->Buffer[0];
7955 rsp->CtlCode = cpu_to_le32(cnt_code);
7956 rsp->InputCount = cpu_to_le32(0);
7957 rsp->InputOffset = cpu_to_le32(112);
7958 rsp->OutputOffset = cpu_to_le32(112);
7959 rsp->OutputCount = cpu_to_le32(nbytes);
7960 rsp->StructureSize = cpu_to_le16(49);
7961 rsp->Reserved = cpu_to_le16(0);
7962 rsp->Flags = cpu_to_le32(0);
7963 rsp->Reserved2 = cpu_to_le32(0);
7964 ret = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_ioctl_rsp) + nbytes);
7970 rsp->hdr.Status = STATUS_ACCESS_DENIED;
7972 rsp->hdr.Status = STATUS_OBJECT_NAME_NOT_FOUND;
7974 rsp->hdr.Status = STATUS_NOT_SUPPORTED;
7976 rsp->hdr.Status = STATUS_BUFFER_TOO_SMALL;
7977 else if (ret < 0 || rsp->hdr.Status == 0)
7978 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
7992 struct smb2_oplock_break *rsp;
8001 WORK_BUFFERS(work, req, rsp);
8011 rsp->hdr.Status = STATUS_FILE_CLOSED;
8019 rsp->hdr.Status = STATUS_INVALID_OPLOCK_PROTOCOL;
8026 rsp->hdr.Status = STATUS_INVALID_OPLOCK_PROTOCOL;
8032 rsp->hdr.Status = STATUS_UNSUCCESSFUL;
8086 rsp->hdr.Status = err;
8095 rsp->StructureSize = cpu_to_le16(24);
8096 rsp->OplockLevel = rsp_oplevel;
8097 rsp->Reserved = 0;
8098 rsp->Reserved2 = 0;
8099 rsp->VolatileFid = volatile_id;
8100 rsp->PersistentFid = persistent_id;
8101 ret = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_oplock_break));
8139 struct smb2_lease_ack *rsp;
8147 WORK_BUFFERS(work, req, rsp);
8155 rsp->hdr.Status = STATUS_UNSUCCESSFUL;
8163 rsp->hdr.Status = STATUS_UNSUCCESSFUL;
8168 rsp->hdr.Status = STATUS_REQUEST_NOT_ACCEPTED;
8176 rsp->hdr.Status = STATUS_UNSUCCESSFUL;
8236 rsp->hdr.Status = err;
8247 rsp->StructureSize = cpu_to_le16(36);
8248 rsp->Reserved = 0;
8249 rsp->Flags = 0;
8250 memcpy(rsp->LeaseKey, req->LeaseKey, 16);
8251 rsp->LeaseState = lease_state;
8252 rsp->LeaseDuration = 0;
8253 ret = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_lease_ack));
8275 struct smb2_oplock_break *rsp;
8277 WORK_BUFFERS(work, req, rsp);
8289 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
8305 struct smb2_change_notify_rsp *rsp;
8307 WORK_BUFFERS(work, req, rsp);
8310 rsp->hdr.Status = STATUS_INTERNAL_ERROR;
8316 rsp->hdr.Status = STATUS_NOT_IMPLEMENTED;
8385 * smb2_set_sign_rsp() - handler for rsp packet sign processing
8473 * smb3_set_sign_rsp() - handler for rsp packet sign processing
8527 struct smb2_hdr *req, *rsp;
8532 WORK_BUFFERS(work, req, rsp);
8539 if (le16_to_cpu(rsp->Command) == SMB2_SESSION_SETUP_HE && sess) {
8653 struct smb2_hdr *rsp = smb2_get_msg(work->response_buf);
8659 rsp = ksmbd_resp_buf_next(work);
8661 if (le16_to_cpu(rsp->Command) == SMB2_SESSION_SETUP_HE &&
8663 rsp->Status == STATUS_SUCCESS)