@@ -1075,31 +1075,28 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon,
10751075 return rc ;
10761076}
10771077
1078-
10791078static int
10801079smb2_set_ea (const unsigned int xid , struct cifs_tcon * tcon ,
10811080 const char * path , const char * ea_name , const void * ea_value ,
10821081 const __u16 ea_value_len , const struct nls_table * nls_codepage ,
10831082 struct cifs_sb_info * cifs_sb )
10841083{
1084+ struct smb2_compound_vars * vars ;
10851085 struct cifs_ses * ses = tcon -> ses ;
10861086 struct TCP_Server_Info * server = cifs_pick_channel (ses );
1087+ struct smb_rqst * rqst ;
1088+ struct kvec * rsp_iov ;
10871089 __le16 * utf16_path = NULL ;
10881090 int ea_name_len = strlen (ea_name );
10891091 int flags = CIFS_CP_CREATE_CLOSE_OP ;
10901092 int len ;
1091- struct smb_rqst rqst [3 ];
10921093 int resp_buftype [3 ];
1093- struct kvec rsp_iov [3 ];
1094- struct kvec open_iov [SMB2_CREATE_IOV_SIZE ];
10951094 struct cifs_open_parms oparms ;
10961095 __u8 oplock = SMB2_OPLOCK_LEVEL_NONE ;
10971096 struct cifs_fid fid ;
1098- struct kvec si_iov [SMB2_SET_INFO_IOV_SIZE ];
10991097 unsigned int size [1 ];
11001098 void * data [1 ];
11011099 struct smb2_file_full_ea_info * ea = NULL ;
1102- struct kvec close_iov [1 ];
11031100 struct smb2_query_info_rsp * rsp ;
11041101 int rc , used_len = 0 ;
11051102
@@ -1113,9 +1110,14 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
11131110 if (!utf16_path )
11141111 return - ENOMEM ;
11151112
1116- memset (rqst , 0 , sizeof (rqst ));
11171113 resp_buftype [0 ] = resp_buftype [1 ] = resp_buftype [2 ] = CIFS_NO_BUFFER ;
1118- memset (rsp_iov , 0 , sizeof (rsp_iov ));
1114+ vars = kzalloc (sizeof (* vars ), GFP_KERNEL );
1115+ if (!vars ) {
1116+ rc = - ENOMEM ;
1117+ goto out_free_path ;
1118+ }
1119+ rqst = vars -> rqst ;
1120+ rsp_iov = vars -> rsp_iov ;
11191121
11201122 if (ses -> server -> ops -> query_all_EAs ) {
11211123 if (!ea_value ) {
@@ -1160,8 +1162,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
11601162 }
11611163
11621164 /* Open */
1163- memset (& open_iov , 0 , sizeof (open_iov ));
1164- rqst [0 ].rq_iov = open_iov ;
1165+ rqst [0 ].rq_iov = vars -> open_iov ;
11651166 rqst [0 ].rq_nvec = SMB2_CREATE_IOV_SIZE ;
11661167
11671168 oparms = (struct cifs_open_parms ) {
@@ -1181,8 +1182,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
11811182
11821183
11831184 /* Set Info */
1184- memset (& si_iov , 0 , sizeof (si_iov ));
1185- rqst [1 ].rq_iov = si_iov ;
1185+ rqst [1 ].rq_iov = vars -> si_iov ;
11861186 rqst [1 ].rq_nvec = 1 ;
11871187
11881188 len = sizeof (* ea ) + ea_name_len + ea_value_len + 1 ;
@@ -1210,10 +1210,8 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
12101210 smb2_set_next_command (tcon , & rqst [1 ]);
12111211 smb2_set_related (& rqst [1 ]);
12121212
1213-
12141213 /* Close */
1215- memset (& close_iov , 0 , sizeof (close_iov ));
1216- rqst [2 ].rq_iov = close_iov ;
1214+ rqst [2 ].rq_iov = & vars -> close_iov ;
12171215 rqst [2 ].rq_nvec = 1 ;
12181216 rc = SMB2_close_init (tcon , server ,
12191217 & rqst [2 ], COMPOUND_FID , COMPOUND_FID , false);
@@ -1228,13 +1226,15 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
12281226
12291227 sea_exit :
12301228 kfree (ea );
1231- kfree (utf16_path );
12321229 SMB2_open_free (& rqst [0 ]);
12331230 SMB2_set_info_free (& rqst [1 ]);
12341231 SMB2_close_free (& rqst [2 ]);
12351232 free_rsp_buf (resp_buftype [0 ], rsp_iov [0 ].iov_base );
12361233 free_rsp_buf (resp_buftype [1 ], rsp_iov [1 ].iov_base );
12371234 free_rsp_buf (resp_buftype [2 ], rsp_iov [2 ].iov_base );
1235+ kfree (vars );
1236+ out_free_path :
1237+ kfree (utf16_path );
12381238 return rc ;
12391239}
12401240#endif
@@ -1445,24 +1445,14 @@ SMB2_request_res_key(const unsigned int xid, struct cifs_tcon *tcon,
14451445 return rc ;
14461446}
14471447
1448- struct iqi_vars {
1449- struct smb_rqst rqst [3 ];
1450- struct kvec rsp_iov [3 ];
1451- struct kvec open_iov [SMB2_CREATE_IOV_SIZE ];
1452- struct kvec qi_iov [1 ];
1453- struct kvec io_iov [SMB2_IOCTL_IOV_SIZE ];
1454- struct kvec si_iov [SMB2_SET_INFO_IOV_SIZE ];
1455- struct kvec close_iov [1 ];
1456- };
1457-
14581448static int
14591449smb2_ioctl_query_info (const unsigned int xid ,
14601450 struct cifs_tcon * tcon ,
14611451 struct cifs_sb_info * cifs_sb ,
14621452 __le16 * path , int is_dir ,
14631453 unsigned long p )
14641454{
1465- struct iqi_vars * vars ;
1455+ struct smb2_compound_vars * vars ;
14661456 struct smb_rqst * rqst ;
14671457 struct kvec * rsp_iov ;
14681458 struct cifs_ses * ses = tcon -> ses ;
@@ -1580,7 +1570,7 @@ smb2_ioctl_query_info(const unsigned int xid,
15801570 rc = - EINVAL ;
15811571 goto free_open_req ;
15821572 }
1583- rqst [1 ].rq_iov = & vars -> si_iov [ 0 ] ;
1573+ rqst [1 ].rq_iov = vars -> si_iov ;
15841574 rqst [1 ].rq_nvec = 1 ;
15851575
15861576 /* MS-FSCC 2.4.13 FileEndOfFileInformation */
@@ -1592,7 +1582,7 @@ smb2_ioctl_query_info(const unsigned int xid,
15921582 SMB2_O_INFO_FILE , 0 , data , size );
15931583 free_req1_func = SMB2_set_info_free ;
15941584 } else if (qi .flags == PASSTHRU_QUERY_INFO ) {
1595- rqst [1 ].rq_iov = & vars -> qi_iov [ 0 ] ;
1585+ rqst [1 ].rq_iov = & vars -> qi_iov ;
15961586 rqst [1 ].rq_nvec = 1 ;
15971587
15981588 rc = SMB2_query_info_init (tcon , server ,
@@ -1614,7 +1604,7 @@ smb2_ioctl_query_info(const unsigned int xid,
16141604 smb2_set_related (& rqst [1 ]);
16151605
16161606 /* Close */
1617- rqst [2 ].rq_iov = & vars -> close_iov [ 0 ] ;
1607+ rqst [2 ].rq_iov = & vars -> close_iov ;
16181608 rqst [2 ].rq_nvec = 1 ;
16191609
16201610 rc = SMB2_close_init (tcon , server ,
0 commit comments