@@ -2513,15 +2513,13 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
2513
2513
struct kvec * rsp , int * buftype ,
2514
2514
struct cifs_sb_info * cifs_sb )
2515
2515
{
2516
+ struct smb2_compound_vars * vars ;
2516
2517
struct cifs_ses * ses = tcon -> ses ;
2517
2518
struct TCP_Server_Info * server = cifs_pick_channel (ses );
2518
2519
int flags = CIFS_CP_CREATE_CLOSE_OP ;
2519
- struct smb_rqst rqst [ 3 ] ;
2520
+ struct smb_rqst * rqst ;
2520
2521
int resp_buftype [3 ];
2521
- struct kvec rsp_iov [3 ];
2522
- struct kvec open_iov [SMB2_CREATE_IOV_SIZE ];
2523
- struct kvec qi_iov [1 ];
2524
- struct kvec close_iov [1 ];
2522
+ struct kvec * rsp_iov ;
2525
2523
u8 oplock = SMB2_OPLOCK_LEVEL_NONE ;
2526
2524
struct cifs_open_parms oparms ;
2527
2525
struct cifs_fid fid ;
@@ -2538,9 +2536,14 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
2538
2536
if (smb3_encryption_required (tcon ))
2539
2537
flags |= CIFS_TRANSFORM_REQ ;
2540
2538
2541
- memset (rqst , 0 , sizeof (rqst ));
2542
2539
resp_buftype [0 ] = resp_buftype [1 ] = resp_buftype [2 ] = CIFS_NO_BUFFER ;
2543
- memset (rsp_iov , 0 , sizeof (rsp_iov ));
2540
+ vars = kzalloc (sizeof (* vars ), GFP_KERNEL );
2541
+ if (!vars ) {
2542
+ rc = - ENOMEM ;
2543
+ goto out_free_path ;
2544
+ }
2545
+ rqst = vars -> rqst ;
2546
+ rsp_iov = vars -> rsp_iov ;
2544
2547
2545
2548
/*
2546
2549
* We can only call this for things we know are directories.
@@ -2549,8 +2552,7 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
2549
2552
open_cached_dir (xid , tcon , path , cifs_sb , false,
2550
2553
& cfid ); /* cfid null if open dir failed */
2551
2554
2552
- memset (& open_iov , 0 , sizeof (open_iov ));
2553
- rqst [0 ].rq_iov = open_iov ;
2555
+ rqst [0 ].rq_iov = vars -> open_iov ;
2554
2556
rqst [0 ].rq_nvec = SMB2_CREATE_IOV_SIZE ;
2555
2557
2556
2558
oparms = (struct cifs_open_parms ) {
@@ -2568,8 +2570,7 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
2568
2570
goto qic_exit ;
2569
2571
smb2_set_next_command (tcon , & rqst [0 ]);
2570
2572
2571
- memset (& qi_iov , 0 , sizeof (qi_iov ));
2572
- rqst [1 ].rq_iov = qi_iov ;
2573
+ rqst [1 ].rq_iov = & vars -> qi_iov ;
2573
2574
rqst [1 ].rq_nvec = 1 ;
2574
2575
2575
2576
if (cfid ) {
@@ -2596,8 +2597,7 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
2596
2597
smb2_set_related (& rqst [1 ]);
2597
2598
}
2598
2599
2599
- memset (& close_iov , 0 , sizeof (close_iov ));
2600
- rqst [2 ].rq_iov = close_iov ;
2600
+ rqst [2 ].rq_iov = & vars -> close_iov ;
2601
2601
rqst [2 ].rq_nvec = 1 ;
2602
2602
2603
2603
rc = SMB2_close_init (tcon , server ,
@@ -2628,14 +2628,16 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
2628
2628
* buftype = resp_buftype [1 ];
2629
2629
2630
2630
qic_exit :
2631
- kfree (utf16_path );
2632
2631
SMB2_open_free (& rqst [0 ]);
2633
2632
SMB2_query_info_free (& rqst [1 ]);
2634
2633
SMB2_close_free (& rqst [2 ]);
2635
2634
free_rsp_buf (resp_buftype [0 ], rsp_iov [0 ].iov_base );
2636
2635
free_rsp_buf (resp_buftype [2 ], rsp_iov [2 ].iov_base );
2637
2636
if (cfid )
2638
2637
close_cached_dir (cfid );
2638
+ kfree (vars );
2639
+ out_free_path :
2640
+ kfree (utf16_path );
2639
2641
return rc ;
2640
2642
}
2641
2643
0 commit comments