@@ -1075,31 +1075,28 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon,
1075
1075
return rc ;
1076
1076
}
1077
1077
1078
-
1079
1078
static int
1080
1079
smb2_set_ea (const unsigned int xid , struct cifs_tcon * tcon ,
1081
1080
const char * path , const char * ea_name , const void * ea_value ,
1082
1081
const __u16 ea_value_len , const struct nls_table * nls_codepage ,
1083
1082
struct cifs_sb_info * cifs_sb )
1084
1083
{
1084
+ struct smb2_compound_vars * vars ;
1085
1085
struct cifs_ses * ses = tcon -> ses ;
1086
1086
struct TCP_Server_Info * server = cifs_pick_channel (ses );
1087
+ struct smb_rqst * rqst ;
1088
+ struct kvec * rsp_iov ;
1087
1089
__le16 * utf16_path = NULL ;
1088
1090
int ea_name_len = strlen (ea_name );
1089
1091
int flags = CIFS_CP_CREATE_CLOSE_OP ;
1090
1092
int len ;
1091
- struct smb_rqst rqst [3 ];
1092
1093
int resp_buftype [3 ];
1093
- struct kvec rsp_iov [3 ];
1094
- struct kvec open_iov [SMB2_CREATE_IOV_SIZE ];
1095
1094
struct cifs_open_parms oparms ;
1096
1095
__u8 oplock = SMB2_OPLOCK_LEVEL_NONE ;
1097
1096
struct cifs_fid fid ;
1098
- struct kvec si_iov [SMB2_SET_INFO_IOV_SIZE ];
1099
1097
unsigned int size [1 ];
1100
1098
void * data [1 ];
1101
1099
struct smb2_file_full_ea_info * ea = NULL ;
1102
- struct kvec close_iov [1 ];
1103
1100
struct smb2_query_info_rsp * rsp ;
1104
1101
int rc , used_len = 0 ;
1105
1102
@@ -1113,9 +1110,14 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
1113
1110
if (!utf16_path )
1114
1111
return - ENOMEM ;
1115
1112
1116
- memset (rqst , 0 , sizeof (rqst ));
1117
1113
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 ;
1119
1121
1120
1122
if (ses -> server -> ops -> query_all_EAs ) {
1121
1123
if (!ea_value ) {
@@ -1160,8 +1162,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
1160
1162
}
1161
1163
1162
1164
/* Open */
1163
- memset (& open_iov , 0 , sizeof (open_iov ));
1164
- rqst [0 ].rq_iov = open_iov ;
1165
+ rqst [0 ].rq_iov = vars -> open_iov ;
1165
1166
rqst [0 ].rq_nvec = SMB2_CREATE_IOV_SIZE ;
1166
1167
1167
1168
oparms = (struct cifs_open_parms ) {
@@ -1181,8 +1182,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
1181
1182
1182
1183
1183
1184
/* 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 ;
1186
1186
rqst [1 ].rq_nvec = 1 ;
1187
1187
1188
1188
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,
1210
1210
smb2_set_next_command (tcon , & rqst [1 ]);
1211
1211
smb2_set_related (& rqst [1 ]);
1212
1212
1213
-
1214
1213
/* Close */
1215
- memset (& close_iov , 0 , sizeof (close_iov ));
1216
- rqst [2 ].rq_iov = close_iov ;
1214
+ rqst [2 ].rq_iov = & vars -> close_iov ;
1217
1215
rqst [2 ].rq_nvec = 1 ;
1218
1216
rc = SMB2_close_init (tcon , server ,
1219
1217
& rqst [2 ], COMPOUND_FID , COMPOUND_FID , false);
@@ -1228,13 +1226,15 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
1228
1226
1229
1227
sea_exit :
1230
1228
kfree (ea );
1231
- kfree (utf16_path );
1232
1229
SMB2_open_free (& rqst [0 ]);
1233
1230
SMB2_set_info_free (& rqst [1 ]);
1234
1231
SMB2_close_free (& rqst [2 ]);
1235
1232
free_rsp_buf (resp_buftype [0 ], rsp_iov [0 ].iov_base );
1236
1233
free_rsp_buf (resp_buftype [1 ], rsp_iov [1 ].iov_base );
1237
1234
free_rsp_buf (resp_buftype [2 ], rsp_iov [2 ].iov_base );
1235
+ kfree (vars );
1236
+ out_free_path :
1237
+ kfree (utf16_path );
1238
1238
return rc ;
1239
1239
}
1240
1240
#endif
@@ -1445,24 +1445,14 @@ SMB2_request_res_key(const unsigned int xid, struct cifs_tcon *tcon,
1445
1445
return rc ;
1446
1446
}
1447
1447
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
-
1458
1448
static int
1459
1449
smb2_ioctl_query_info (const unsigned int xid ,
1460
1450
struct cifs_tcon * tcon ,
1461
1451
struct cifs_sb_info * cifs_sb ,
1462
1452
__le16 * path , int is_dir ,
1463
1453
unsigned long p )
1464
1454
{
1465
- struct iqi_vars * vars ;
1455
+ struct smb2_compound_vars * vars ;
1466
1456
struct smb_rqst * rqst ;
1467
1457
struct kvec * rsp_iov ;
1468
1458
struct cifs_ses * ses = tcon -> ses ;
@@ -1580,7 +1570,7 @@ smb2_ioctl_query_info(const unsigned int xid,
1580
1570
rc = - EINVAL ;
1581
1571
goto free_open_req ;
1582
1572
}
1583
- rqst [1 ].rq_iov = & vars -> si_iov [ 0 ] ;
1573
+ rqst [1 ].rq_iov = vars -> si_iov ;
1584
1574
rqst [1 ].rq_nvec = 1 ;
1585
1575
1586
1576
/* MS-FSCC 2.4.13 FileEndOfFileInformation */
@@ -1592,7 +1582,7 @@ smb2_ioctl_query_info(const unsigned int xid,
1592
1582
SMB2_O_INFO_FILE , 0 , data , size );
1593
1583
free_req1_func = SMB2_set_info_free ;
1594
1584
} else if (qi .flags == PASSTHRU_QUERY_INFO ) {
1595
- rqst [1 ].rq_iov = & vars -> qi_iov [ 0 ] ;
1585
+ rqst [1 ].rq_iov = & vars -> qi_iov ;
1596
1586
rqst [1 ].rq_nvec = 1 ;
1597
1587
1598
1588
rc = SMB2_query_info_init (tcon , server ,
@@ -1614,7 +1604,7 @@ smb2_ioctl_query_info(const unsigned int xid,
1614
1604
smb2_set_related (& rqst [1 ]);
1615
1605
1616
1606
/* Close */
1617
- rqst [2 ].rq_iov = & vars -> close_iov [ 0 ] ;
1607
+ rqst [2 ].rq_iov = & vars -> close_iov ;
1618
1608
rqst [2 ].rq_nvec = 1 ;
1619
1609
1620
1610
rc = SMB2_close_init (tcon , server ,
0 commit comments