aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c315
1 files changed, 192 insertions, 123 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 95fbba4ea7d4..7b9938445b07 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -81,6 +81,40 @@ static struct {
81#endif /* CONFIG_CIFS_WEAK_PW_HASH */ 81#endif /* CONFIG_CIFS_WEAK_PW_HASH */
82#endif /* CIFS_POSIX */ 82#endif /* CIFS_POSIX */
83 83
84/* Allocates buffer into dst and copies smb string from src to it.
85 * caller is responsible for freeing dst if function returned 0.
86 * returns:
87 * on success - 0
88 * on failure - errno
89 */
90static int
91cifs_strncpy_to_host(char **dst, const char *src, const int maxlen,
92 const bool is_unicode, const struct nls_table *nls_codepage)
93{
94 int plen;
95
96 if (is_unicode) {
97 plen = UniStrnlen((wchar_t *)src, maxlen);
98 *dst = kmalloc(plen + 2, GFP_KERNEL);
99 if (!*dst)
100 goto cifs_strncpy_to_host_ErrExit;
101 cifs_strfromUCS_le(*dst, (__le16 *)src, plen, nls_codepage);
102 } else {
103 plen = strnlen(src, maxlen);
104 *dst = kmalloc(plen + 2, GFP_KERNEL);
105 if (!*dst)
106 goto cifs_strncpy_to_host_ErrExit;
107 strncpy(*dst, src, plen);
108 }
109 (*dst)[plen] = 0;
110 (*dst)[plen+1] = 0; /* harmless for ASCII case, needed for Unicode */
111 return 0;
112
113cifs_strncpy_to_host_ErrExit:
114 cERROR(1, ("Failed to allocate buffer for string\n"));
115 return -ENOMEM;
116}
117
84 118
85/* Mark as invalid, all open files on tree connections since they 119/* Mark as invalid, all open files on tree connections since they
86 were closed when session to server was lost */ 120 were closed when session to server was lost */
@@ -1166,6 +1200,20 @@ static __u16 convert_disposition(int disposition)
1166 return ofun; 1200 return ofun;
1167} 1201}
1168 1202
1203static int
1204access_flags_to_smbopen_mode(const int access_flags)
1205{
1206 int masked_flags = access_flags & (GENERIC_READ | GENERIC_WRITE);
1207
1208 if (masked_flags == GENERIC_READ)
1209 return SMBOPEN_READ;
1210 else if (masked_flags == GENERIC_WRITE)
1211 return SMBOPEN_WRITE;
1212
1213 /* just go for read/write */
1214 return SMBOPEN_READWRITE;
1215}
1216
1169int 1217int
1170SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon, 1218SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon,
1171 const char *fileName, const int openDisposition, 1219 const char *fileName, const int openDisposition,
@@ -1207,13 +1255,7 @@ OldOpenRetry:
1207 pSMB->OpenFlags = cpu_to_le16(REQ_BATCHOPLOCK); 1255 pSMB->OpenFlags = cpu_to_le16(REQ_BATCHOPLOCK);
1208 1256
1209 pSMB->OpenFlags |= cpu_to_le16(REQ_MORE_INFO); 1257 pSMB->OpenFlags |= cpu_to_le16(REQ_MORE_INFO);
1210 /* BB fixme add conversion for access_flags to bits 0 - 2 of mode */ 1258 pSMB->Mode = cpu_to_le16(access_flags_to_smbopen_mode(access_flags));
1211 /* 0 = read
1212 1 = write
1213 2 = rw
1214 3 = execute
1215 */
1216 pSMB->Mode = cpu_to_le16(2);
1217 pSMB->Mode |= cpu_to_le16(0x40); /* deny none */ 1259 pSMB->Mode |= cpu_to_le16(0x40); /* deny none */
1218 /* set file as system file if special file such 1260 /* set file as system file if special file such
1219 as fifo and server expecting SFU style and 1261 as fifo and server expecting SFU style and
@@ -1247,7 +1289,7 @@ OldOpenRetry:
1247 } else { 1289 } else {
1248 /* BB verify if wct == 15 */ 1290 /* BB verify if wct == 15 */
1249 1291
1250/* *pOplock = pSMBr->OplockLevel; */ /* BB take from action field BB */ 1292/* *pOplock = pSMBr->OplockLevel; */ /* BB take from action field*/
1251 1293
1252 *netfid = pSMBr->Fid; /* cifs fid stays in le */ 1294 *netfid = pSMBr->Fid; /* cifs fid stays in le */
1253 /* Let caller know file was created so we can set the mode. */ 1295 /* Let caller know file was created so we can set the mode. */
@@ -1767,7 +1809,7 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
1767 cFYI(1, ("Posix Lock")); 1809 cFYI(1, ("Posix Lock"));
1768 1810
1769 if (pLockData == NULL) 1811 if (pLockData == NULL)
1770 return EINVAL; 1812 return -EINVAL;
1771 1813
1772 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB); 1814 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
1773 1815
@@ -1944,7 +1986,7 @@ renameRetry:
1944 /* protocol requires ASCII signature byte on Unicode string */ 1986 /* protocol requires ASCII signature byte on Unicode string */
1945 pSMB->OldFileName[name_len + 1] = 0x00; 1987 pSMB->OldFileName[name_len + 1] = 0x00;
1946 name_len2 = 1988 name_len2 =
1947 cifsConvertToUCS((__le16 *) &pSMB->OldFileName[name_len + 2], 1989 cifsConvertToUCS((__le16 *)&pSMB->OldFileName[name_len + 2],
1948 toName, PATH_MAX, nls_codepage, remap); 1990 toName, PATH_MAX, nls_codepage, remap);
1949 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 1991 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
1950 name_len2 *= 2; /* convert to bytes */ 1992 name_len2 *= 2; /* convert to bytes */
@@ -2925,7 +2967,8 @@ setAclRetry:
2925 } 2967 }
2926 params = 6 + name_len; 2968 params = 6 + name_len;
2927 pSMB->MaxParameterCount = cpu_to_le16(2); 2969 pSMB->MaxParameterCount = cpu_to_le16(2);
2928 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB size from sess */ 2970 /* BB find max SMB size from sess */
2971 pSMB->MaxDataCount = cpu_to_le16(1000);
2929 pSMB->MaxSetupCount = 0; 2972 pSMB->MaxSetupCount = 0;
2930 pSMB->Reserved = 0; 2973 pSMB->Reserved = 0;
2931 pSMB->Flags = 0; 2974 pSMB->Flags = 0;
@@ -3322,7 +3365,8 @@ QPathInfoRetry:
3322 params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; 3365 params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */;
3323 pSMB->TotalDataCount = 0; 3366 pSMB->TotalDataCount = 0;
3324 pSMB->MaxParameterCount = cpu_to_le16(2); 3367 pSMB->MaxParameterCount = cpu_to_le16(2);
3325 pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ 3368 /* BB find exact max SMB PDU from sess structure BB */
3369 pSMB->MaxDataCount = cpu_to_le16(4000);
3326 pSMB->MaxSetupCount = 0; 3370 pSMB->MaxSetupCount = 0;
3327 pSMB->Reserved = 0; 3371 pSMB->Reserved = 0;
3328 pSMB->Flags = 0; 3372 pSMB->Flags = 0;
@@ -3388,7 +3432,7 @@ QPathInfoRetry:
3388int 3432int
3389CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon, 3433CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon,
3390 const unsigned char *searchName, 3434 const unsigned char *searchName,
3391 FILE_UNIX_BASIC_INFO * pFindData, 3435 FILE_UNIX_BASIC_INFO *pFindData,
3392 const struct nls_table *nls_codepage, int remap) 3436 const struct nls_table *nls_codepage, int remap)
3393{ 3437{
3394/* SMB_QUERY_FILE_UNIX_BASIC */ 3438/* SMB_QUERY_FILE_UNIX_BASIC */
@@ -3679,6 +3723,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
3679 if (rc) { 3723 if (rc) {
3680 if (rc == -EBADF) { 3724 if (rc == -EBADF) {
3681 psrch_inf->endOfSearch = true; 3725 psrch_inf->endOfSearch = true;
3726 cifs_buf_release(pSMB);
3682 rc = 0; /* search probably was closed at end of search*/ 3727 rc = 0; /* search probably was closed at end of search*/
3683 } else 3728 } else
3684 cFYI(1, ("FindNext returned = %d", rc)); 3729 cFYI(1, ("FindNext returned = %d", rc));
@@ -3856,25 +3901,112 @@ GetInodeNumOut:
3856 return rc; 3901 return rc;
3857} 3902}
3858 3903
3904/* parses DFS refferal V3 structure
3905 * caller is responsible for freeing target_nodes
3906 * returns:
3907 * on success - 0
3908 * on failure - errno
3909 */
3910static int
3911parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
3912 unsigned int *num_of_nodes,
3913 struct dfs_info3_param **target_nodes,
3914 const struct nls_table *nls_codepage)
3915{
3916 int i, rc = 0;
3917 char *data_end;
3918 bool is_unicode;
3919 struct dfs_referral_level_3 *ref;
3920
3921 is_unicode = pSMBr->hdr.Flags2 & SMBFLG2_UNICODE;
3922 *num_of_nodes = le16_to_cpu(pSMBr->NumberOfReferrals);
3923
3924 if (*num_of_nodes < 1) {
3925 cERROR(1, ("num_referrals: must be at least > 0,"
3926 "but we get num_referrals = %d\n", *num_of_nodes));
3927 rc = -EINVAL;
3928 goto parse_DFS_referrals_exit;
3929 }
3930
3931 ref = (struct dfs_referral_level_3 *) &(pSMBr->referrals);
3932 if (ref->VersionNumber != 3) {
3933 cERROR(1, ("Referrals of V%d version are not supported,"
3934 "should be V3", ref->VersionNumber));
3935 rc = -EINVAL;
3936 goto parse_DFS_referrals_exit;
3937 }
3938
3939 /* get the upper boundary of the resp buffer */
3940 data_end = (char *)(&(pSMBr->PathConsumed)) +
3941 le16_to_cpu(pSMBr->t2.DataCount);
3942
3943 cFYI(1, ("num_referrals: %d dfs flags: 0x%x ... \n",
3944 *num_of_nodes,
3945 le16_to_cpu(pSMBr->DFSFlags)));
3946
3947 *target_nodes = kzalloc(sizeof(struct dfs_info3_param) *
3948 *num_of_nodes, GFP_KERNEL);
3949 if (*target_nodes == NULL) {
3950 cERROR(1, ("Failed to allocate buffer for target_nodes\n"));
3951 rc = -ENOMEM;
3952 goto parse_DFS_referrals_exit;
3953 }
3954
3955 /* collect neccessary data from referrals */
3956 for (i = 0; i < *num_of_nodes; i++) {
3957 char *temp;
3958 int max_len;
3959 struct dfs_info3_param *node = (*target_nodes)+i;
3960
3961 node->flags = le16_to_cpu(pSMBr->DFSFlags);
3962 node->path_consumed = le16_to_cpu(pSMBr->PathConsumed);
3963 node->server_type = le16_to_cpu(ref->ServerType);
3964 node->ref_flag = le16_to_cpu(ref->ReferralEntryFlags);
3965
3966 /* copy DfsPath */
3967 temp = (char *)ref + le16_to_cpu(ref->DfsPathOffset);
3968 max_len = data_end - temp;
3969 rc = cifs_strncpy_to_host(&(node->path_name), temp,
3970 max_len, is_unicode, nls_codepage);
3971 if (rc)
3972 goto parse_DFS_referrals_exit;
3973
3974 /* copy link target UNC */
3975 temp = (char *)ref + le16_to_cpu(ref->NetworkAddressOffset);
3976 max_len = data_end - temp;
3977 rc = cifs_strncpy_to_host(&(node->node_name), temp,
3978 max_len, is_unicode, nls_codepage);
3979 if (rc)
3980 goto parse_DFS_referrals_exit;
3981
3982 ref += ref->Size;
3983 }
3984
3985parse_DFS_referrals_exit:
3986 if (rc) {
3987 free_dfs_info_array(*target_nodes, *num_of_nodes);
3988 *target_nodes = NULL;
3989 *num_of_nodes = 0;
3990 }
3991 return rc;
3992}
3993
3859int 3994int
3860CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses, 3995CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses,
3861 const unsigned char *searchName, 3996 const unsigned char *searchName,
3862 unsigned char **targetUNCs, 3997 struct dfs_info3_param **target_nodes,
3863 unsigned int *number_of_UNC_in_array, 3998 unsigned int *num_of_nodes,
3864 const struct nls_table *nls_codepage, int remap) 3999 const struct nls_table *nls_codepage, int remap)
3865{ 4000{
3866/* TRANS2_GET_DFS_REFERRAL */ 4001/* TRANS2_GET_DFS_REFERRAL */
3867 TRANSACTION2_GET_DFS_REFER_REQ *pSMB = NULL; 4002 TRANSACTION2_GET_DFS_REFER_REQ *pSMB = NULL;
3868 TRANSACTION2_GET_DFS_REFER_RSP *pSMBr = NULL; 4003 TRANSACTION2_GET_DFS_REFER_RSP *pSMBr = NULL;
3869 struct dfs_referral_level_3 *referrals = NULL;
3870 int rc = 0; 4004 int rc = 0;
3871 int bytes_returned; 4005 int bytes_returned;
3872 int name_len; 4006 int name_len;
3873 unsigned int i;
3874 char *temp;
3875 __u16 params, byte_count; 4007 __u16 params, byte_count;
3876 *number_of_UNC_in_array = 0; 4008 *num_of_nodes = 0;
3877 *targetUNCs = NULL; 4009 *target_nodes = NULL;
3878 4010
3879 cFYI(1, ("In GetDFSRefer the path %s", searchName)); 4011 cFYI(1, ("In GetDFSRefer the path %s", searchName));
3880 if (ses == NULL) 4012 if (ses == NULL)
@@ -3921,7 +4053,8 @@ getDFSRetry:
3921 pSMB->DataCount = 0; 4053 pSMB->DataCount = 0;
3922 pSMB->DataOffset = 0; 4054 pSMB->DataOffset = 0;
3923 pSMB->MaxParameterCount = 0; 4055 pSMB->MaxParameterCount = 0;
3924 pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ 4056 /* BB find exact max SMB PDU from sess structure BB */
4057 pSMB->MaxDataCount = cpu_to_le16(4000);
3925 pSMB->MaxSetupCount = 0; 4058 pSMB->MaxSetupCount = 0;
3926 pSMB->Reserved = 0; 4059 pSMB->Reserved = 0;
3927 pSMB->Flags = 0; 4060 pSMB->Flags = 0;
@@ -3943,100 +4076,24 @@ getDFSRetry:
3943 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 4076 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
3944 if (rc) { 4077 if (rc) {
3945 cFYI(1, ("Send error in GetDFSRefer = %d", rc)); 4078 cFYI(1, ("Send error in GetDFSRefer = %d", rc));
3946 } else { /* decode response */ 4079 goto GetDFSRefExit;
3947/* BB Add logic to parse referrals here */ 4080 }
3948 rc = validate_t2((struct smb_t2_rsp *)pSMBr); 4081 rc = validate_t2((struct smb_t2_rsp *)pSMBr);
3949 4082
3950 /* BB Also check if enough total bytes returned? */ 4083 /* BB Also check if enough total bytes returned? */
3951 if (rc || (pSMBr->ByteCount < 17)) 4084 if (rc || (pSMBr->ByteCount < 17)) {
3952 rc = -EIO; /* bad smb */ 4085 rc = -EIO; /* bad smb */
3953 else { 4086 goto GetDFSRefExit;
3954 __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset); 4087 }
3955 __u16 data_count = le16_to_cpu(pSMBr->t2.DataCount);
3956 4088
3957 cFYI(1, 4089 cFYI(1, ("Decoding GetDFSRefer response BCC: %d Offset %d",
3958 ("Decoding GetDFSRefer response BCC: %d Offset %d", 4090 pSMBr->ByteCount,
3959 pSMBr->ByteCount, data_offset)); 4091 le16_to_cpu(pSMBr->t2.DataOffset)));
3960 referrals =
3961 (struct dfs_referral_level_3 *)
3962 (8 /* sizeof start of data block */ +
3963 data_offset +
3964 (char *) &pSMBr->hdr.Protocol);
3965 cFYI(1, ("num_referrals: %d dfs flags: 0x%x ... \n"
3966 "for referral one refer size: 0x%x srv "
3967 "type: 0x%x refer flags: 0x%x ttl: 0x%x",
3968 le16_to_cpu(pSMBr->NumberOfReferrals),
3969 le16_to_cpu(pSMBr->DFSFlags),
3970 le16_to_cpu(referrals->ReferralSize),
3971 le16_to_cpu(referrals->ServerType),
3972 le16_to_cpu(referrals->ReferralFlags),
3973 le16_to_cpu(referrals->TimeToLive)));
3974 /* BB This field is actually two bytes in from start of
3975 data block so we could do safety check that DataBlock
3976 begins at address of pSMBr->NumberOfReferrals */
3977 *number_of_UNC_in_array =
3978 le16_to_cpu(pSMBr->NumberOfReferrals);
3979
3980 /* BB Fix below so can return more than one referral */
3981 if (*number_of_UNC_in_array > 1)
3982 *number_of_UNC_in_array = 1;
3983
3984 /* get the length of the strings describing refs */
3985 name_len = 0;
3986 for (i = 0; i < *number_of_UNC_in_array; i++) {
3987 /* make sure that DfsPathOffset not past end */
3988 __u16 offset =
3989 le16_to_cpu(referrals->DfsPathOffset);
3990 if (offset > data_count) {
3991 /* if invalid referral, stop here and do
3992 not try to copy any more */
3993 *number_of_UNC_in_array = i;
3994 break;
3995 }
3996 temp = ((char *)referrals) + offset;
3997 4092
3998 if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { 4093 /* parse returned result into more usable form */
3999 name_len += UniStrnlen((wchar_t *)temp, 4094 rc = parse_DFS_referrals(pSMBr, num_of_nodes,
4000 data_count); 4095 target_nodes, nls_codepage);
4001 } else {
4002 name_len += strnlen(temp, data_count);
4003 }
4004 referrals++;
4005 /* BB add check that referral pointer does
4006 not fall off end PDU */
4007 }
4008 /* BB add check for name_len bigger than bcc */
4009 *targetUNCs =
4010 kmalloc(name_len+1+(*number_of_UNC_in_array),
4011 GFP_KERNEL);
4012 if (*targetUNCs == NULL) {
4013 rc = -ENOMEM;
4014 goto GetDFSRefExit;
4015 }
4016 /* copy the ref strings */
4017 referrals = (struct dfs_referral_level_3 *)
4018 (8 /* sizeof data hdr */ + data_offset +
4019 (char *) &pSMBr->hdr.Protocol);
4020
4021 for (i = 0; i < *number_of_UNC_in_array; i++) {
4022 temp = ((char *)referrals) +
4023 le16_to_cpu(referrals->DfsPathOffset);
4024 if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) {
4025 cifs_strfromUCS_le(*targetUNCs,
4026 (__le16 *) temp,
4027 name_len,
4028 nls_codepage);
4029 } else {
4030 strncpy(*targetUNCs, temp, name_len);
4031 }
4032 /* BB update target_uncs pointers */
4033 referrals++;
4034 }
4035 temp = *targetUNCs;
4036 temp[name_len] = 0;
4037 }
4038 4096
4039 }
4040GetDFSRefExit: 4097GetDFSRefExit:
4041 if (pSMB) 4098 if (pSMB)
4042 cifs_buf_release(pSMB); 4099 cifs_buf_release(pSMB);
@@ -4229,7 +4286,8 @@ QFSAttributeRetry:
4229 params = 2; /* level */ 4286 params = 2; /* level */
4230 pSMB->TotalDataCount = 0; 4287 pSMB->TotalDataCount = 0;
4231 pSMB->MaxParameterCount = cpu_to_le16(2); 4288 pSMB->MaxParameterCount = cpu_to_le16(2);
4232 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ 4289 /* BB find exact max SMB PDU from sess structure BB */
4290 pSMB->MaxDataCount = cpu_to_le16(1000);
4233 pSMB->MaxSetupCount = 0; 4291 pSMB->MaxSetupCount = 0;
4234 pSMB->Reserved = 0; 4292 pSMB->Reserved = 0;
4235 pSMB->Flags = 0; 4293 pSMB->Flags = 0;
@@ -4298,7 +4356,8 @@ QFSDeviceRetry:
4298 params = 2; /* level */ 4356 params = 2; /* level */
4299 pSMB->TotalDataCount = 0; 4357 pSMB->TotalDataCount = 0;
4300 pSMB->MaxParameterCount = cpu_to_le16(2); 4358 pSMB->MaxParameterCount = cpu_to_le16(2);
4301 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ 4359 /* BB find exact max SMB PDU from sess structure BB */
4360 pSMB->MaxDataCount = cpu_to_le16(1000);
4302 pSMB->MaxSetupCount = 0; 4361 pSMB->MaxSetupCount = 0;
4303 pSMB->Reserved = 0; 4362 pSMB->Reserved = 0;
4304 pSMB->Flags = 0; 4363 pSMB->Flags = 0;
@@ -4369,7 +4428,8 @@ QFSUnixRetry:
4369 pSMB->DataCount = 0; 4428 pSMB->DataCount = 0;
4370 pSMB->DataOffset = 0; 4429 pSMB->DataOffset = 0;
4371 pSMB->MaxParameterCount = cpu_to_le16(2); 4430 pSMB->MaxParameterCount = cpu_to_le16(2);
4372 pSMB->MaxDataCount = cpu_to_le16(100); /* BB find exact max SMB PDU from sess structure BB */ 4431 /* BB find exact max SMB PDU from sess structure BB */
4432 pSMB->MaxDataCount = cpu_to_le16(100);
4373 pSMB->MaxSetupCount = 0; 4433 pSMB->MaxSetupCount = 0;
4374 pSMB->Reserved = 0; 4434 pSMB->Reserved = 0;
4375 pSMB->Flags = 0; 4435 pSMB->Flags = 0;
@@ -4444,7 +4504,8 @@ SETFSUnixRetry:
4444 offset = param_offset + params; 4504 offset = param_offset + params;
4445 4505
4446 pSMB->MaxParameterCount = cpu_to_le16(4); 4506 pSMB->MaxParameterCount = cpu_to_le16(4);
4447 pSMB->MaxDataCount = cpu_to_le16(100); /* BB find exact max SMB PDU from sess structure BB */ 4507 /* BB find exact max SMB PDU from sess structure BB */
4508 pSMB->MaxDataCount = cpu_to_le16(100);
4448 pSMB->SetupCount = 1; 4509 pSMB->SetupCount = 1;
4449 pSMB->Reserved3 = 0; 4510 pSMB->Reserved3 = 0;
4450 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FS_INFORMATION); 4511 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FS_INFORMATION);
@@ -4512,7 +4573,8 @@ QFSPosixRetry:
4512 pSMB->DataCount = 0; 4573 pSMB->DataCount = 0;
4513 pSMB->DataOffset = 0; 4574 pSMB->DataOffset = 0;
4514 pSMB->MaxParameterCount = cpu_to_le16(2); 4575 pSMB->MaxParameterCount = cpu_to_le16(2);
4515 pSMB->MaxDataCount = cpu_to_le16(100); /* BB find exact max SMB PDU from sess structure BB */ 4576 /* BB find exact max SMB PDU from sess structure BB */
4577 pSMB->MaxDataCount = cpu_to_le16(100);
4516 pSMB->MaxSetupCount = 0; 4578 pSMB->MaxSetupCount = 0;
4517 pSMB->Reserved = 0; 4579 pSMB->Reserved = 0;
4518 pSMB->Flags = 0; 4580 pSMB->Flags = 0;
@@ -4702,7 +4764,8 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
4702 4764
4703 count = sizeof(struct file_end_of_file_info); 4765 count = sizeof(struct file_end_of_file_info);
4704 pSMB->MaxParameterCount = cpu_to_le16(2); 4766 pSMB->MaxParameterCount = cpu_to_le16(2);
4705 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ 4767 /* BB find exact max SMB PDU from sess structure BB */
4768 pSMB->MaxDataCount = cpu_to_le16(1000);
4706 pSMB->SetupCount = 1; 4769 pSMB->SetupCount = 1;
4707 pSMB->Reserved3 = 0; 4770 pSMB->Reserved3 = 0;
4708 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); 4771 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
@@ -4789,7 +4852,8 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon,
4789 4852
4790 count = sizeof(FILE_BASIC_INFO); 4853 count = sizeof(FILE_BASIC_INFO);
4791 pSMB->MaxParameterCount = cpu_to_le16(2); 4854 pSMB->MaxParameterCount = cpu_to_le16(2);
4792 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ 4855 /* BB find max SMB PDU from sess */
4856 pSMB->MaxDataCount = cpu_to_le16(1000);
4793 pSMB->SetupCount = 1; 4857 pSMB->SetupCount = 1;
4794 pSMB->Reserved3 = 0; 4858 pSMB->Reserved3 = 0;
4795 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); 4859 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
@@ -4856,7 +4920,8 @@ SetTimesRetry:
4856 params = 6 + name_len; 4920 params = 6 + name_len;
4857 count = sizeof(FILE_BASIC_INFO); 4921 count = sizeof(FILE_BASIC_INFO);
4858 pSMB->MaxParameterCount = cpu_to_le16(2); 4922 pSMB->MaxParameterCount = cpu_to_le16(2);
4859 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ 4923 /* BB find max SMB PDU from sess structure BB */
4924 pSMB->MaxDataCount = cpu_to_le16(1000);
4860 pSMB->MaxSetupCount = 0; 4925 pSMB->MaxSetupCount = 0;
4861 pSMB->Reserved = 0; 4926 pSMB->Reserved = 0;
4862 pSMB->Flags = 0; 4927 pSMB->Flags = 0;
@@ -4986,7 +5051,8 @@ setPermsRetry:
4986 params = 6 + name_len; 5051 params = 6 + name_len;
4987 count = sizeof(FILE_UNIX_BASIC_INFO); 5052 count = sizeof(FILE_UNIX_BASIC_INFO);
4988 pSMB->MaxParameterCount = cpu_to_le16(2); 5053 pSMB->MaxParameterCount = cpu_to_le16(2);
4989 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ 5054 /* BB find max SMB PDU from sess structure BB */
5055 pSMB->MaxDataCount = cpu_to_le16(1000);
4990 pSMB->MaxSetupCount = 0; 5056 pSMB->MaxSetupCount = 0;
4991 pSMB->Reserved = 0; 5057 pSMB->Reserved = 0;
4992 pSMB->Flags = 0; 5058 pSMB->Flags = 0;
@@ -5169,7 +5235,8 @@ QAllEAsRetry:
5169 params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; 5235 params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */;
5170 pSMB->TotalDataCount = 0; 5236 pSMB->TotalDataCount = 0;
5171 pSMB->MaxParameterCount = cpu_to_le16(2); 5237 pSMB->MaxParameterCount = cpu_to_le16(2);
5172 pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ 5238 /* BB find exact max SMB PDU from sess structure BB */
5239 pSMB->MaxDataCount = cpu_to_le16(4000);
5173 pSMB->MaxSetupCount = 0; 5240 pSMB->MaxSetupCount = 0;
5174 pSMB->Reserved = 0; 5241 pSMB->Reserved = 0;
5175 pSMB->Flags = 0; 5242 pSMB->Flags = 0;
@@ -5317,7 +5384,8 @@ QEARetry:
5317 params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; 5384 params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */;
5318 pSMB->TotalDataCount = 0; 5385 pSMB->TotalDataCount = 0;
5319 pSMB->MaxParameterCount = cpu_to_le16(2); 5386 pSMB->MaxParameterCount = cpu_to_le16(2);
5320 pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ 5387 /* BB find exact max SMB PDU from sess structure BB */
5388 pSMB->MaxDataCount = cpu_to_le16(4000);
5321 pSMB->MaxSetupCount = 0; 5389 pSMB->MaxSetupCount = 0;
5322 pSMB->Reserved = 0; 5390 pSMB->Reserved = 0;
5323 pSMB->Flags = 0; 5391 pSMB->Flags = 0;
@@ -5475,7 +5543,8 @@ SetEARetry:
5475 5543
5476 count = sizeof(*parm_data) + ea_value_len + name_len; 5544 count = sizeof(*parm_data) + ea_value_len + name_len;
5477 pSMB->MaxParameterCount = cpu_to_le16(2); 5545 pSMB->MaxParameterCount = cpu_to_le16(2);
5478 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB size from sess */ 5546 /* BB find max SMB PDU from sess */
5547 pSMB->MaxDataCount = cpu_to_le16(1000);
5479 pSMB->MaxSetupCount = 0; 5548 pSMB->MaxSetupCount = 0;
5480 pSMB->Reserved = 0; 5549 pSMB->Reserved = 0;
5481 pSMB->Flags = 0; 5550 pSMB->Flags = 0;