@@ -821,7 +821,6 @@ create_posix_buf(umode_t mode)
821
821
static int
822
822
add_posix_context (struct kvec * iov , unsigned int * num_iovec , umode_t mode )
823
823
{
824
- struct smb2_create_req * req = iov [0 ].iov_base ;
825
824
unsigned int num = * num_iovec ;
826
825
827
826
iov [num ].iov_base = create_posix_buf (mode );
@@ -830,7 +829,6 @@ add_posix_context(struct kvec *iov, unsigned int *num_iovec, umode_t mode)
830
829
if (iov [num ].iov_base == NULL )
831
830
return - ENOMEM ;
832
831
iov [num ].iov_len = sizeof (struct create_posix );
833
- le32_add_cpu (& req -> CreateContextsLength , sizeof (struct create_posix ));
834
832
* num_iovec = num + 1 ;
835
833
return 0 ;
836
834
}
@@ -2179,8 +2177,6 @@ add_lease_context(struct TCP_Server_Info *server, struct kvec *iov,
2179
2177
return - ENOMEM ;
2180
2178
iov [num ].iov_len = server -> vals -> create_lease_size ;
2181
2179
req -> RequestedOplockLevel = SMB2_OPLOCK_LEVEL_LEASE ;
2182
- le32_add_cpu (& req -> CreateContextsLength ,
2183
- server -> vals -> create_lease_size );
2184
2180
* num_iovec = num + 1 ;
2185
2181
return 0 ;
2186
2182
}
@@ -2259,14 +2255,12 @@ static int
2259
2255
add_durable_v2_context (struct kvec * iov , unsigned int * num_iovec ,
2260
2256
struct cifs_open_parms * oparms )
2261
2257
{
2262
- struct smb2_create_req * req = iov [0 ].iov_base ;
2263
2258
unsigned int num = * num_iovec ;
2264
2259
2265
2260
iov [num ].iov_base = create_durable_v2_buf (oparms );
2266
2261
if (iov [num ].iov_base == NULL )
2267
2262
return - ENOMEM ;
2268
2263
iov [num ].iov_len = sizeof (struct create_durable_v2 );
2269
- le32_add_cpu (& req -> CreateContextsLength , sizeof (struct create_durable_v2 ));
2270
2264
* num_iovec = num + 1 ;
2271
2265
return 0 ;
2272
2266
}
@@ -2275,7 +2269,6 @@ static int
2275
2269
add_durable_reconnect_v2_context (struct kvec * iov , unsigned int * num_iovec ,
2276
2270
struct cifs_open_parms * oparms )
2277
2271
{
2278
- struct smb2_create_req * req = iov [0 ].iov_base ;
2279
2272
unsigned int num = * num_iovec ;
2280
2273
2281
2274
/* indicate that we don't need to relock the file */
@@ -2285,8 +2278,6 @@ add_durable_reconnect_v2_context(struct kvec *iov, unsigned int *num_iovec,
2285
2278
if (iov [num ].iov_base == NULL )
2286
2279
return - ENOMEM ;
2287
2280
iov [num ].iov_len = sizeof (struct create_durable_handle_reconnect_v2 );
2288
- le32_add_cpu (& req -> CreateContextsLength ,
2289
- sizeof (struct create_durable_handle_reconnect_v2 ));
2290
2281
* num_iovec = num + 1 ;
2291
2282
return 0 ;
2292
2283
}
@@ -2295,7 +2286,6 @@ static int
2295
2286
add_durable_context (struct kvec * iov , unsigned int * num_iovec ,
2296
2287
struct cifs_open_parms * oparms , bool use_persistent )
2297
2288
{
2298
- struct smb2_create_req * req = iov [0 ].iov_base ;
2299
2289
unsigned int num = * num_iovec ;
2300
2290
2301
2291
if (use_persistent ) {
@@ -2315,7 +2305,6 @@ add_durable_context(struct kvec *iov, unsigned int *num_iovec,
2315
2305
if (iov [num ].iov_base == NULL )
2316
2306
return - ENOMEM ;
2317
2307
iov [num ].iov_len = sizeof (struct create_durable );
2318
- le32_add_cpu (& req -> CreateContextsLength , sizeof (struct create_durable ));
2319
2308
* num_iovec = num + 1 ;
2320
2309
return 0 ;
2321
2310
}
@@ -2349,14 +2338,12 @@ create_twarp_buf(__u64 timewarp)
2349
2338
static int
2350
2339
add_twarp_context (struct kvec * iov , unsigned int * num_iovec , __u64 timewarp )
2351
2340
{
2352
- struct smb2_create_req * req = iov [0 ].iov_base ;
2353
2341
unsigned int num = * num_iovec ;
2354
2342
2355
2343
iov [num ].iov_base = create_twarp_buf (timewarp );
2356
2344
if (iov [num ].iov_base == NULL )
2357
2345
return - ENOMEM ;
2358
2346
iov [num ].iov_len = sizeof (struct crt_twarp_ctxt );
2359
- le32_add_cpu (& req -> CreateContextsLength , sizeof (struct crt_twarp_ctxt ));
2360
2347
* num_iovec = num + 1 ;
2361
2348
return 0 ;
2362
2349
}
@@ -2479,15 +2466,13 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len)
2479
2466
static int
2480
2467
add_sd_context (struct kvec * iov , unsigned int * num_iovec , umode_t mode , bool set_owner )
2481
2468
{
2482
- struct smb2_create_req * req = iov [0 ].iov_base ;
2483
2469
unsigned int num = * num_iovec ;
2484
2470
unsigned int len = 0 ;
2485
2471
2486
2472
iov [num ].iov_base = create_sd_buf (mode , set_owner , & len );
2487
2473
if (iov [num ].iov_base == NULL )
2488
2474
return - ENOMEM ;
2489
2475
iov [num ].iov_len = len ;
2490
- le32_add_cpu (& req -> CreateContextsLength , len );
2491
2476
* num_iovec = num + 1 ;
2492
2477
return 0 ;
2493
2478
}
@@ -2518,14 +2503,12 @@ create_query_id_buf(void)
2518
2503
static int
2519
2504
add_query_id_context (struct kvec * iov , unsigned int * num_iovec )
2520
2505
{
2521
- struct smb2_create_req * req = iov [0 ].iov_base ;
2522
2506
unsigned int num = * num_iovec ;
2523
2507
2524
2508
iov [num ].iov_base = create_query_id_buf ();
2525
2509
if (iov [num ].iov_base == NULL )
2526
2510
return - ENOMEM ;
2527
2511
iov [num ].iov_len = sizeof (struct crt_query_id_ctxt );
2528
- le32_add_cpu (& req -> CreateContextsLength , sizeof (struct crt_query_id_ctxt ));
2529
2512
* num_iovec = num + 1 ;
2530
2513
return 0 ;
2531
2514
}
@@ -2889,6 +2872,7 @@ SMB2_open_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
2889
2872
req -> CreateContextsOffset = cpu_to_le32 (
2890
2873
sizeof (struct smb2_create_req ) +
2891
2874
iov [1 ].iov_len );
2875
+ req -> CreateContextsLength = 0 ;
2892
2876
2893
2877
for (unsigned int i = 2 ; i < (n_iov - 1 ); i ++ ) {
2894
2878
struct kvec * v = & iov [i ];
@@ -2897,7 +2881,10 @@ SMB2_open_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
2897
2881
(struct create_context * )v -> iov_base ;
2898
2882
2899
2883
cctx -> Next = cpu_to_le32 (len );
2884
+ le32_add_cpu (& req -> CreateContextsLength , len );
2900
2885
}
2886
+ le32_add_cpu (& req -> CreateContextsLength ,
2887
+ iov [n_iov - 1 ].iov_len );
2901
2888
}
2902
2889
2903
2890
rqst -> rq_nvec = n_iov ;
0 commit comments