aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2transport.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/smb2transport.c')
-rw-r--r--fs/cifs/smb2transport.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c
index 9ca4bcfb34c6..2a5fdf26f79f 100644
--- a/fs/cifs/smb2transport.c
+++ b/fs/cifs/smb2transport.c
@@ -281,50 +281,44 @@ smb2_check_receive(struct mid_q_entry *mid, struct TCP_Server_Info *server,
281 return map_smb2_to_linux_error(mid->resp_buf, log_error); 281 return map_smb2_to_linux_error(mid->resp_buf, log_error);
282} 282}
283 283
284int 284struct mid_q_entry *
285smb2_setup_request(struct cifs_ses *ses, struct kvec *iov, 285smb2_setup_request(struct cifs_ses *ses, struct smb_rqst *rqst)
286 unsigned int nvec, struct mid_q_entry **ret_mid)
287{ 286{
288 int rc; 287 int rc;
289 struct smb2_hdr *hdr = (struct smb2_hdr *)iov[0].iov_base; 288 struct smb2_hdr *hdr = (struct smb2_hdr *)rqst->rq_iov[0].iov_base;
290 struct mid_q_entry *mid; 289 struct mid_q_entry *mid;
291 struct smb_rqst rqst = { .rq_iov = iov,
292 .rq_nvec = nvec };
293 290
294 smb2_seq_num_into_buf(ses->server, hdr); 291 smb2_seq_num_into_buf(ses->server, hdr);
295 292
296 rc = smb2_get_mid_entry(ses, hdr, &mid); 293 rc = smb2_get_mid_entry(ses, hdr, &mid);
297 if (rc) 294 if (rc)
298 return rc; 295 return ERR_PTR(rc);
299 rc = smb2_sign_rqst(&rqst, ses->server); 296 rc = smb2_sign_rqst(rqst, ses->server);
300 if (rc) 297 if (rc) {
301 cifs_delete_mid(mid); 298 cifs_delete_mid(mid);
302 *ret_mid = mid; 299 return ERR_PTR(rc);
303 return rc; 300 }
301 return mid;
304} 302}
305 303
306int 304struct mid_q_entry *
307smb2_setup_async_request(struct TCP_Server_Info *server, struct kvec *iov, 305smb2_setup_async_request(struct TCP_Server_Info *server, struct smb_rqst *rqst)
308 unsigned int nvec, struct mid_q_entry **ret_mid)
309{ 306{
310 int rc = 0; 307 int rc;
311 struct smb2_hdr *hdr = (struct smb2_hdr *)iov[0].iov_base; 308 struct smb2_hdr *hdr = (struct smb2_hdr *)rqst->rq_iov[0].iov_base;
312 struct mid_q_entry *mid; 309 struct mid_q_entry *mid;
313 struct smb_rqst rqst = { .rq_iov = iov,
314 .rq_nvec = nvec };
315 310
316 smb2_seq_num_into_buf(server, hdr); 311 smb2_seq_num_into_buf(server, hdr);
317 312
318 mid = smb2_mid_entry_alloc(hdr, server); 313 mid = smb2_mid_entry_alloc(hdr, server);
319 if (mid == NULL) 314 if (mid == NULL)
320 return -ENOMEM; 315 return ERR_PTR(-ENOMEM);
321 316
322 rc = smb2_sign_rqst(&rqst, server); 317 rc = smb2_sign_rqst(rqst, server);
323 if (rc) { 318 if (rc) {
324 DeleteMidQEntry(mid); 319 DeleteMidQEntry(mid);
325 return rc; 320 return ERR_PTR(rc);
326 } 321 }
327 322
328 *ret_mid = mid; 323 return mid;
329 return rc;
330} 324}