diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/asn1.c | 10 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 20 | ||||
-rw-r--r-- | fs/cifs/cifsfs.h | 2 | ||||
-rw-r--r-- | fs/cifs/cifspdu.h | 6 | ||||
-rw-r--r-- | fs/cifs/cifsproto.h | 2 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 44 | ||||
-rw-r--r-- | fs/cifs/connect.c | 48 | ||||
-rw-r--r-- | fs/cifs/readdir.c | 2 | ||||
-rw-r--r-- | fs/cifs/sess.c | 27 | ||||
-rw-r--r-- | fs/cifs/transport.c | 24 |
10 files changed, 80 insertions, 105 deletions
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c index f50a88d58f78..2a01f3ef96a0 100644 --- a/fs/cifs/asn1.c +++ b/fs/cifs/asn1.c | |||
@@ -385,10 +385,9 @@ asn1_oid_decode(struct asn1_ctx *ctx, | |||
385 | unsigned long *optr; | 385 | unsigned long *optr; |
386 | 386 | ||
387 | size = eoc - ctx->pointer + 1; | 387 | size = eoc - ctx->pointer + 1; |
388 | *oid = kmalloc(size * sizeof (unsigned long), GFP_ATOMIC); | 388 | *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC); |
389 | if (*oid == NULL) { | 389 | if (*oid == NULL) |
390 | return 0; | 390 | return 0; |
391 | } | ||
392 | 391 | ||
393 | optr = *oid; | 392 | optr = *oid; |
394 | 393 | ||
@@ -581,9 +580,8 @@ decode_negTokenInit(unsigned char *security_blob, int length, | |||
581 | return 0; | 580 | return 0; |
582 | } else if ((cls != ASN1_UNI) || (con != ASN1_CON) | 581 | } else if ((cls != ASN1_UNI) || (con != ASN1_CON) |
583 | || (tag != ASN1_SEQ)) { | 582 | || (tag != ASN1_SEQ)) { |
584 | cFYI(1, | 583 | cFYI(1, ("cls = %d con = %d tag = %d end = %p (%d)", |
585 | ("Exit 6 cls = %d con = %d tag = %d end = %p (%d)", | 584 | cls, con, tag, end, *end)); |
586 | cls, con, tag, end, *end)); | ||
587 | } | 585 | } |
588 | 586 | ||
589 | if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { | 587 | if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 2493cc4f9e7f..c7c3521aa7cd 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -240,9 +240,9 @@ static int cifs_permission(struct inode *inode, int mask, struct nameidata *nd) | |||
240 | 240 | ||
241 | cifs_sb = CIFS_SB(inode->i_sb); | 241 | cifs_sb = CIFS_SB(inode->i_sb); |
242 | 242 | ||
243 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) { | 243 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) |
244 | return 0; | 244 | return 0; |
245 | } else /* file mode might have been restricted at mount time | 245 | else /* file mode might have been restricted at mount time |
246 | on the client (above and beyond ACL on servers) for | 246 | on the client (above and beyond ACL on servers) for |
247 | servers which do not support setting and viewing mode bits, | 247 | servers which do not support setting and viewing mode bits, |
248 | so allowing client to check permissions is useful */ | 248 | so allowing client to check permissions is useful */ |
@@ -716,7 +716,7 @@ static int | |||
716 | cifs_init_inodecache(void) | 716 | cifs_init_inodecache(void) |
717 | { | 717 | { |
718 | cifs_inode_cachep = kmem_cache_create("cifs_inode_cache", | 718 | cifs_inode_cachep = kmem_cache_create("cifs_inode_cache", |
719 | sizeof (struct cifsInodeInfo), | 719 | sizeof(struct cifsInodeInfo), |
720 | 0, (SLAB_RECLAIM_ACCOUNT| | 720 | 0, (SLAB_RECLAIM_ACCOUNT| |
721 | SLAB_MEM_SPREAD), | 721 | SLAB_MEM_SPREAD), |
722 | cifs_init_once); | 722 | cifs_init_once); |
@@ -816,8 +816,8 @@ static int | |||
816 | cifs_init_mids(void) | 816 | cifs_init_mids(void) |
817 | { | 817 | { |
818 | cifs_mid_cachep = kmem_cache_create("cifs_mpx_ids", | 818 | cifs_mid_cachep = kmem_cache_create("cifs_mpx_ids", |
819 | sizeof (struct mid_q_entry), 0, | 819 | sizeof(struct mid_q_entry), 0, |
820 | SLAB_HWCACHE_ALIGN, NULL); | 820 | SLAB_HWCACHE_ALIGN, NULL); |
821 | if (cifs_mid_cachep == NULL) | 821 | if (cifs_mid_cachep == NULL) |
822 | return -ENOMEM; | 822 | return -ENOMEM; |
823 | 823 | ||
@@ -829,8 +829,8 @@ cifs_init_mids(void) | |||
829 | } | 829 | } |
830 | 830 | ||
831 | cifs_oplock_cachep = kmem_cache_create("cifs_oplock_structs", | 831 | cifs_oplock_cachep = kmem_cache_create("cifs_oplock_structs", |
832 | sizeof (struct oplock_q_entry), 0, | 832 | sizeof(struct oplock_q_entry), 0, |
833 | SLAB_HWCACHE_ALIGN, NULL); | 833 | SLAB_HWCACHE_ALIGN, NULL); |
834 | if (cifs_oplock_cachep == NULL) { | 834 | if (cifs_oplock_cachep == NULL) { |
835 | mempool_destroy(cifs_mid_poolp); | 835 | mempool_destroy(cifs_mid_poolp); |
836 | kmem_cache_destroy(cifs_mid_cachep); | 836 | kmem_cache_destroy(cifs_mid_cachep); |
@@ -882,7 +882,8 @@ static int cifs_oplock_thread(void *dummyarg) | |||
882 | the call */ | 882 | the call */ |
883 | /* mutex_lock(&inode->i_mutex);*/ | 883 | /* mutex_lock(&inode->i_mutex);*/ |
884 | if (S_ISREG(inode->i_mode)) { | 884 | if (S_ISREG(inode->i_mode)) { |
885 | rc = filemap_fdatawrite(inode->i_mapping); | 885 | rc = |
886 | filemap_fdatawrite(inode->i_mapping); | ||
886 | if (CIFS_I(inode)->clientCanCacheRead | 887 | if (CIFS_I(inode)->clientCanCacheRead |
887 | == 0) { | 888 | == 0) { |
888 | filemap_fdatawait(inode->i_mapping); | 889 | filemap_fdatawait(inode->i_mapping); |
@@ -907,8 +908,7 @@ static int cifs_oplock_thread(void *dummyarg) | |||
907 | 0 /* len */ , 0 /* offset */, 0, | 908 | 0 /* len */ , 0 /* offset */, 0, |
908 | 0, LOCKING_ANDX_OPLOCK_RELEASE, | 909 | 0, LOCKING_ANDX_OPLOCK_RELEASE, |
909 | 0 /* wait flag */); | 910 | 0 /* wait flag */); |
910 | cFYI(1, | 911 | cFYI(1, ("Oplock release rc = %d", rc)); |
911 | ("Oplock release rc = %d ", rc)); | ||
912 | } | 912 | } |
913 | } else | 913 | } else |
914 | spin_unlock(&GlobalMid_Lock); | 914 | spin_unlock(&GlobalMid_Lock); |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index a20de77a3856..dd64cecd923b 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -99,7 +99,7 @@ extern int cifs_setxattr(struct dentry *, const char *, const void *, | |||
99 | size_t, int); | 99 | size_t, int); |
100 | extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t); | 100 | extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t); |
101 | extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); | 101 | extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); |
102 | extern int cifs_ioctl (struct inode *inode, struct file *filep, | 102 | extern int cifs_ioctl(struct inode *inode, struct file *filep, |
103 | unsigned int command, unsigned long arg); | 103 | unsigned int command, unsigned long arg); |
104 | #define CIFS_VERSION "1.50" | 104 | #define CIFS_VERSION "1.50" |
105 | #endif /* _CIFSFS_H */ | 105 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index 6a2056e58ceb..e975ce46115d 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -360,10 +360,10 @@ struct smb_hdr { | |||
360 | __u8 WordCount; | 360 | __u8 WordCount; |
361 | } __attribute__((packed)); | 361 | } __attribute__((packed)); |
362 | /* given a pointer to an smb_hdr retrieve the value of byte count */ | 362 | /* given a pointer to an smb_hdr retrieve the value of byte count */ |
363 | #define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) ) | 363 | #define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2 * smb_var->WordCount))) |
364 | #define BCC_LE(smb_var) ( *(__le16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) ) | 364 | #define BCC_LE(smb_var) ( *(__le16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2 * smb_var->WordCount))) |
365 | /* given a pointer to an smb_hdr retrieve the pointer to the byte area */ | 365 | /* given a pointer to an smb_hdr retrieve the pointer to the byte area */ |
366 | #define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 ) | 366 | #define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2 * smb_var->WordCount) + 2) |
367 | 367 | ||
368 | /* | 368 | /* |
369 | * Computer Name Length (since Netbios name was length 16 with last byte 0x20) | 369 | * Computer Name Length (since Netbios name was length 16 with last byte 0x20) |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 04a69dafedba..4ffae9d92910 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -304,7 +304,7 @@ extern int cifs_calculate_mac_key(struct mac_key *key, const char *rn, | |||
304 | const char *pass); | 304 | const char *pass); |
305 | extern int CalcNTLMv2_partial_mac_key(struct cifsSesInfo *, | 305 | extern int CalcNTLMv2_partial_mac_key(struct cifsSesInfo *, |
306 | const struct nls_table *); | 306 | const struct nls_table *); |
307 | extern void CalcNTLMv2_response(const struct cifsSesInfo *, char * ); | 307 | extern void CalcNTLMv2_response(const struct cifsSesInfo *, char *); |
308 | extern void setup_ntlmv2_rsp(struct cifsSesInfo *, char *, | 308 | extern void setup_ntlmv2_rsp(struct cifsSesInfo *, char *, |
309 | const struct nls_table *); | 309 | const struct nls_table *); |
310 | #ifdef CONFIG_CIFS_WEAK_PW_HASH | 310 | #ifdef CONFIG_CIFS_WEAK_PW_HASH |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 4795143ff521..bb30455caabc 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -94,9 +94,8 @@ static void mark_open_files_invalid(struct cifsTconInfo *pTcon) | |||
94 | write_lock(&GlobalSMBSeslock); | 94 | write_lock(&GlobalSMBSeslock); |
95 | list_for_each_safe(tmp, tmp1, &pTcon->openFileList) { | 95 | list_for_each_safe(tmp, tmp1, &pTcon->openFileList) { |
96 | open_file = list_entry(tmp, struct cifsFileInfo, tlist); | 96 | open_file = list_entry(tmp, struct cifsFileInfo, tlist); |
97 | if (open_file) { | 97 | if (open_file) |
98 | open_file->invalidHandle = TRUE; | 98 | open_file->invalidHandle = TRUE; |
99 | } | ||
100 | } | 99 | } |
101 | write_unlock(&GlobalSMBSeslock); | 100 | write_unlock(&GlobalSMBSeslock); |
102 | /* BB Add call to invalidate_inodes(sb) for all superblocks mounted | 101 | /* BB Add call to invalidate_inodes(sb) for all superblocks mounted |
@@ -1112,7 +1111,7 @@ PsxCreat: | |||
1112 | } | 1111 | } |
1113 | memcpy((char *) pRetData, | 1112 | memcpy((char *) pRetData, |
1114 | (char *)psx_rsp + sizeof(OPEN_PSX_RSP), | 1113 | (char *)psx_rsp + sizeof(OPEN_PSX_RSP), |
1115 | sizeof (FILE_UNIX_BASIC_INFO)); | 1114 | sizeof(FILE_UNIX_BASIC_INFO)); |
1116 | } | 1115 | } |
1117 | 1116 | ||
1118 | psx_create_err: | 1117 | psx_create_err: |
@@ -1193,9 +1192,9 @@ OldOpenRetry: | |||
1193 | } | 1192 | } |
1194 | if (*pOplock & REQ_OPLOCK) | 1193 | if (*pOplock & REQ_OPLOCK) |
1195 | pSMB->OpenFlags = cpu_to_le16(REQ_OPLOCK); | 1194 | pSMB->OpenFlags = cpu_to_le16(REQ_OPLOCK); |
1196 | else if (*pOplock & REQ_BATCHOPLOCK) { | 1195 | else if (*pOplock & REQ_BATCHOPLOCK) |
1197 | pSMB->OpenFlags = cpu_to_le16(REQ_BATCHOPLOCK); | 1196 | pSMB->OpenFlags = cpu_to_le16(REQ_BATCHOPLOCK); |
1198 | } | 1197 | |
1199 | pSMB->OpenFlags |= cpu_to_le16(REQ_MORE_INFO); | 1198 | pSMB->OpenFlags |= cpu_to_le16(REQ_MORE_INFO); |
1200 | /* BB fixme add conversion for access_flags to bits 0 - 2 of mode */ | 1199 | /* BB fixme add conversion for access_flags to bits 0 - 2 of mode */ |
1201 | /* 0 = read | 1200 | /* 0 = read |
@@ -1310,9 +1309,8 @@ openRetry: | |||
1310 | } | 1309 | } |
1311 | if (*pOplock & REQ_OPLOCK) | 1310 | if (*pOplock & REQ_OPLOCK) |
1312 | pSMB->OpenFlags = cpu_to_le32(REQ_OPLOCK); | 1311 | pSMB->OpenFlags = cpu_to_le32(REQ_OPLOCK); |
1313 | else if (*pOplock & REQ_BATCHOPLOCK) { | 1312 | else if (*pOplock & REQ_BATCHOPLOCK) |
1314 | pSMB->OpenFlags = cpu_to_le32(REQ_BATCHOPLOCK); | 1313 | pSMB->OpenFlags = cpu_to_le32(REQ_BATCHOPLOCK); |
1315 | } | ||
1316 | pSMB->DesiredAccess = cpu_to_le32(access_flags); | 1314 | pSMB->DesiredAccess = cpu_to_le32(access_flags); |
1317 | pSMB->AllocationSize = 0; | 1315 | pSMB->AllocationSize = 0; |
1318 | /* set file as system file if special file such | 1316 | /* set file as system file if special file such |
@@ -1446,11 +1444,11 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid, | |||
1446 | *nbytes = 0; | 1444 | *nbytes = 0; |
1447 | } else { | 1445 | } else { |
1448 | pReadData = (char *) (&pSMBr->hdr.Protocol) + | 1446 | pReadData = (char *) (&pSMBr->hdr.Protocol) + |
1449 | le16_to_cpu(pSMBr->DataOffset); | 1447 | le16_to_cpu(pSMBr->DataOffset); |
1450 | /* if (rc = copy_to_user(buf, pReadData, data_length)) { | 1448 | /* if (rc = copy_to_user(buf, pReadData, data_length)) { |
1451 | cERROR(1,("Faulting on read rc = %d",rc)); | 1449 | cERROR(1,("Faulting on read rc = %d",rc)); |
1452 | rc = -EFAULT; | 1450 | rc = -EFAULT; |
1453 | }*/ /* can not use copy_to_user when using page cache*/ | 1451 | }*/ /* can not use copy_to_user when using page cache*/ |
1454 | if (*buf) | 1452 | if (*buf) |
1455 | memcpy(*buf, pReadData, data_length); | 1453 | memcpy(*buf, pReadData, data_length); |
1456 | } | 1454 | } |
@@ -2538,7 +2536,7 @@ validate_ntransact(char *buf, char **ppparm, char **ppdata, | |||
2538 | cFYI(1, ("data starts after end of smb")); | 2536 | cFYI(1, ("data starts after end of smb")); |
2539 | return -EINVAL; | 2537 | return -EINVAL; |
2540 | } else if (data_count + *ppdata > end_of_smb) { | 2538 | } else if (data_count + *ppdata > end_of_smb) { |
2541 | cFYI(1,("data %p + count %d (%p) ends after end of smb %p start %p", | 2539 | cFYI(1, ("data %p + count %d (%p) ends after end of smb %p start %p", |
2542 | *ppdata, data_count, (data_count + *ppdata), | 2540 | *ppdata, data_count, (data_count + *ppdata), |
2543 | end_of_smb, pSMBr)); | 2541 | end_of_smb, pSMBr)); |
2544 | return -EINVAL; | 2542 | return -EINVAL; |
@@ -2615,7 +2613,7 @@ CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon, | |||
2615 | reparse_buf->TargetNameOffset + | 2613 | reparse_buf->TargetNameOffset + |
2616 | reparse_buf->TargetNameLen) > | 2614 | reparse_buf->TargetNameLen) > |
2617 | end_of_smb) { | 2615 | end_of_smb) { |
2618 | cFYI(1,("reparse buf goes beyond SMB")); | 2616 | cFYI(1, ("reparse buf beyond SMB")); |
2619 | rc = -EIO; | 2617 | rc = -EIO; |
2620 | goto qreparse_out; | 2618 | goto qreparse_out; |
2621 | } | 2619 | } |
@@ -3883,12 +3881,10 @@ getDFSRetry: | |||
3883 | pSMB->hdr.Mid = GetNextMid(ses->server); | 3881 | pSMB->hdr.Mid = GetNextMid(ses->server); |
3884 | pSMB->hdr.Tid = ses->ipc_tid; | 3882 | pSMB->hdr.Tid = ses->ipc_tid; |
3885 | pSMB->hdr.Uid = ses->Suid; | 3883 | pSMB->hdr.Uid = ses->Suid; |
3886 | if (ses->capabilities & CAP_STATUS32) { | 3884 | if (ses->capabilities & CAP_STATUS32) |
3887 | pSMB->hdr.Flags2 |= SMBFLG2_ERR_STATUS; | 3885 | pSMB->hdr.Flags2 |= SMBFLG2_ERR_STATUS; |
3888 | } | 3886 | if (ses->capabilities & CAP_DFS) |
3889 | if (ses->capabilities & CAP_DFS) { | ||
3890 | pSMB->hdr.Flags2 |= SMBFLG2_DFS; | 3887 | pSMB->hdr.Flags2 |= SMBFLG2_DFS; |
3891 | } | ||
3892 | 3888 | ||
3893 | if (ses->capabilities & CAP_UNICODE) { | 3889 | if (ses->capabilities & CAP_UNICODE) { |
3894 | pSMB->hdr.Flags2 |= SMBFLG2_UNICODE; | 3890 | pSMB->hdr.Flags2 |= SMBFLG2_UNICODE; |
@@ -4265,7 +4261,7 @@ QFSAttributeRetry: | |||
4265 | *) (((char *) &pSMBr->hdr.Protocol) + | 4261 | *) (((char *) &pSMBr->hdr.Protocol) + |
4266 | data_offset); | 4262 | data_offset); |
4267 | memcpy(&tcon->fsAttrInfo, response_data, | 4263 | memcpy(&tcon->fsAttrInfo, response_data, |
4268 | sizeof (FILE_SYSTEM_ATTRIBUTE_INFO)); | 4264 | sizeof(FILE_SYSTEM_ATTRIBUTE_INFO)); |
4269 | } | 4265 | } |
4270 | } | 4266 | } |
4271 | cifs_buf_release(pSMB); | 4267 | cifs_buf_release(pSMB); |
@@ -4334,7 +4330,7 @@ QFSDeviceRetry: | |||
4334 | (((char *) &pSMBr->hdr.Protocol) + | 4330 | (((char *) &pSMBr->hdr.Protocol) + |
4335 | data_offset); | 4331 | data_offset); |
4336 | memcpy(&tcon->fsDevInfo, response_data, | 4332 | memcpy(&tcon->fsDevInfo, response_data, |
4337 | sizeof (FILE_SYSTEM_DEVICE_INFO)); | 4333 | sizeof(FILE_SYSTEM_DEVICE_INFO)); |
4338 | } | 4334 | } |
4339 | } | 4335 | } |
4340 | cifs_buf_release(pSMB); | 4336 | cifs_buf_release(pSMB); |
@@ -4402,7 +4398,7 @@ QFSUnixRetry: | |||
4402 | *) (((char *) &pSMBr->hdr.Protocol) + | 4398 | *) (((char *) &pSMBr->hdr.Protocol) + |
4403 | data_offset); | 4399 | data_offset); |
4404 | memcpy(&tcon->fsUnixInfo, response_data, | 4400 | memcpy(&tcon->fsUnixInfo, response_data, |
4405 | sizeof (FILE_SYSTEM_UNIX_INFO)); | 4401 | sizeof(FILE_SYSTEM_UNIX_INFO)); |
4406 | } | 4402 | } |
4407 | } | 4403 | } |
4408 | cifs_buf_release(pSMB); | 4404 | cifs_buf_release(pSMB); |
@@ -4612,7 +4608,7 @@ SetEOFRetry: | |||
4612 | strncpy(pSMB->FileName, fileName, name_len); | 4608 | strncpy(pSMB->FileName, fileName, name_len); |
4613 | } | 4609 | } |
4614 | params = 6 + name_len; | 4610 | params = 6 + name_len; |
4615 | data_count = sizeof (struct file_end_of_file_info); | 4611 | data_count = sizeof(struct file_end_of_file_info); |
4616 | pSMB->MaxParameterCount = cpu_to_le16(2); | 4612 | pSMB->MaxParameterCount = cpu_to_le16(2); |
4617 | pSMB->MaxDataCount = cpu_to_le16(4100); | 4613 | pSMB->MaxDataCount = cpu_to_le16(4100); |
4618 | pSMB->MaxSetupCount = 0; | 4614 | pSMB->MaxSetupCount = 0; |
@@ -4800,7 +4796,7 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, | |||
4800 | 4796 | ||
4801 | data_offset = (char *) (&pSMB->hdr.Protocol) + offset; | 4797 | data_offset = (char *) (&pSMB->hdr.Protocol) + offset; |
4802 | 4798 | ||
4803 | count = sizeof (FILE_BASIC_INFO); | 4799 | count = sizeof(FILE_BASIC_INFO); |
4804 | pSMB->MaxParameterCount = cpu_to_le16(2); | 4800 | pSMB->MaxParameterCount = cpu_to_le16(2); |
4805 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ | 4801 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ |
4806 | pSMB->SetupCount = 1; | 4802 | pSMB->SetupCount = 1; |
@@ -4871,7 +4867,7 @@ SetTimesRetry: | |||
4871 | } | 4867 | } |
4872 | 4868 | ||
4873 | params = 6 + name_len; | 4869 | params = 6 + name_len; |
4874 | count = sizeof (FILE_BASIC_INFO); | 4870 | count = sizeof(FILE_BASIC_INFO); |
4875 | pSMB->MaxParameterCount = cpu_to_le16(2); | 4871 | pSMB->MaxParameterCount = cpu_to_le16(2); |
4876 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ | 4872 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ |
4877 | pSMB->MaxSetupCount = 0; | 4873 | pSMB->MaxSetupCount = 0; |
@@ -4900,7 +4896,7 @@ SetTimesRetry: | |||
4900 | pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO); | 4896 | pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO); |
4901 | pSMB->Reserved4 = 0; | 4897 | pSMB->Reserved4 = 0; |
4902 | pSMB->hdr.smb_buf_length += byte_count; | 4898 | pSMB->hdr.smb_buf_length += byte_count; |
4903 | memcpy(data_offset, data, sizeof (FILE_BASIC_INFO)); | 4899 | memcpy(data_offset, data, sizeof(FILE_BASIC_INFO)); |
4904 | pSMB->ByteCount = cpu_to_le16(byte_count); | 4900 | pSMB->ByteCount = cpu_to_le16(byte_count); |
4905 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 4901 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
4906 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 4902 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
@@ -5003,7 +4999,7 @@ setPermsRetry: | |||
5003 | } | 4999 | } |
5004 | 5000 | ||
5005 | params = 6 + name_len; | 5001 | params = 6 + name_len; |
5006 | count = sizeof (FILE_UNIX_BASIC_INFO); | 5002 | count = sizeof(FILE_UNIX_BASIC_INFO); |
5007 | pSMB->MaxParameterCount = cpu_to_le16(2); | 5003 | pSMB->MaxParameterCount = cpu_to_le16(2); |
5008 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ | 5004 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ |
5009 | pSMB->MaxSetupCount = 0; | 5005 | pSMB->MaxSetupCount = 0; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 8af993f8d0cc..3dd2d23e0649 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -124,7 +124,7 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
124 | struct mid_q_entry *mid_entry; | 124 | struct mid_q_entry *mid_entry; |
125 | 125 | ||
126 | spin_lock(&GlobalMid_Lock); | 126 | spin_lock(&GlobalMid_Lock); |
127 | if ( kthread_should_stop() ) { | 127 | if (kthread_should_stop()) { |
128 | /* the demux thread will exit normally | 128 | /* the demux thread will exit normally |
129 | next time through the loop */ | 129 | next time through the loop */ |
130 | spin_unlock(&GlobalMid_Lock); | 130 | spin_unlock(&GlobalMid_Lock); |
@@ -151,9 +151,8 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
151 | } | 151 | } |
152 | list_for_each(tmp, &GlobalTreeConnectionList) { | 152 | list_for_each(tmp, &GlobalTreeConnectionList) { |
153 | tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); | 153 | tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); |
154 | if ((tcon) && (tcon->ses) && (tcon->ses->server == server)) { | 154 | if ((tcon) && (tcon->ses) && (tcon->ses->server == server)) |
155 | tcon->tidStatus = CifsNeedReconnect; | 155 | tcon->tidStatus = CifsNeedReconnect; |
156 | } | ||
157 | } | 156 | } |
158 | read_unlock(&GlobalSMBSeslock); | 157 | read_unlock(&GlobalSMBSeslock); |
159 | /* do not want to be sending data on a socket we are freeing */ | 158 | /* do not want to be sending data on a socket we are freeing */ |
@@ -187,7 +186,7 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
187 | spin_unlock(&GlobalMid_Lock); | 186 | spin_unlock(&GlobalMid_Lock); |
188 | up(&server->tcpSem); | 187 | up(&server->tcpSem); |
189 | 188 | ||
190 | while ( (!kthread_should_stop()) && (server->tcpStatus != CifsGood)) { | 189 | while ((!kthread_should_stop()) && (server->tcpStatus != CifsGood)) { |
191 | try_to_freeze(); | 190 | try_to_freeze(); |
192 | if (server->protocolType == IPV6) { | 191 | if (server->protocolType == IPV6) { |
193 | rc = ipv6_connect(&server->addr.sockAddr6, | 192 | rc = ipv6_connect(&server->addr.sockAddr6, |
@@ -204,7 +203,7 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
204 | } else { | 203 | } else { |
205 | atomic_inc(&tcpSesReconnectCount); | 204 | atomic_inc(&tcpSesReconnectCount); |
206 | spin_lock(&GlobalMid_Lock); | 205 | spin_lock(&GlobalMid_Lock); |
207 | if ( !kthread_should_stop() ) | 206 | if (!kthread_should_stop()) |
208 | server->tcpStatus = CifsGood; | 207 | server->tcpStatus = CifsGood; |
209 | server->sequence_number = 0; | 208 | server->sequence_number = 0; |
210 | spin_unlock(&GlobalMid_Lock); | 209 | spin_unlock(&GlobalMid_Lock); |
@@ -358,11 +357,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
358 | length = tcpSesAllocCount.counter; | 357 | length = tcpSesAllocCount.counter; |
359 | write_unlock(&GlobalSMBSeslock); | 358 | write_unlock(&GlobalSMBSeslock); |
360 | complete(&cifsd_complete); | 359 | complete(&cifsd_complete); |
361 | if (length > 1) { | 360 | if (length > 1) |
362 | mempool_resize(cifs_req_poolp, | 361 | mempool_resize(cifs_req_poolp, length + cifs_min_rcv, |
363 | length + cifs_min_rcv, | 362 | GFP_KERNEL); |
364 | GFP_KERNEL); | ||
365 | } | ||
366 | 363 | ||
367 | set_freezable(); | 364 | set_freezable(); |
368 | while (!kthread_should_stop()) { | 365 | while (!kthread_should_stop()) { |
@@ -378,7 +375,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
378 | } | 375 | } |
379 | } else if (isLargeBuf) { | 376 | } else if (isLargeBuf) { |
380 | /* we are reusing a dirty large buf, clear its start */ | 377 | /* we are reusing a dirty large buf, clear its start */ |
381 | memset(bigbuf, 0, sizeof (struct smb_hdr)); | 378 | memset(bigbuf, 0, sizeof(struct smb_hdr)); |
382 | } | 379 | } |
383 | 380 | ||
384 | if (smallbuf == NULL) { | 381 | if (smallbuf == NULL) { |
@@ -391,7 +388,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
391 | } | 388 | } |
392 | /* beginning of smb buffer is cleared in our buf_get */ | 389 | /* beginning of smb buffer is cleared in our buf_get */ |
393 | } else /* if existing small buf clear beginning */ | 390 | } else /* if existing small buf clear beginning */ |
394 | memset(smallbuf, 0, sizeof (struct smb_hdr)); | 391 | memset(smallbuf, 0, sizeof(struct smb_hdr)); |
395 | 392 | ||
396 | isLargeBuf = FALSE; | 393 | isLargeBuf = FALSE; |
397 | isMultiRsp = FALSE; | 394 | isMultiRsp = FALSE; |
@@ -406,7 +403,7 @@ incomplete_rcv: | |||
406 | kernel_recvmsg(csocket, &smb_msg, | 403 | kernel_recvmsg(csocket, &smb_msg, |
407 | &iov, 1, pdu_length, 0 /* BB other flags? */); | 404 | &iov, 1, pdu_length, 0 /* BB other flags? */); |
408 | 405 | ||
409 | if ( kthread_should_stop() ) { | 406 | if (kthread_should_stop()) { |
410 | break; | 407 | break; |
411 | } else if (server->tcpStatus == CifsNeedReconnect) { | 408 | } else if (server->tcpStatus == CifsNeedReconnect) { |
412 | cFYI(1, ("Reconnect after server stopped responding")); | 409 | cFYI(1, ("Reconnect after server stopped responding")); |
@@ -505,7 +502,7 @@ incomplete_rcv: | |||
505 | 502 | ||
506 | /* else we have an SMB response */ | 503 | /* else we have an SMB response */ |
507 | if ((pdu_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) || | 504 | if ((pdu_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) || |
508 | (pdu_length < sizeof (struct smb_hdr) - 1 - 4)) { | 505 | (pdu_length < sizeof(struct smb_hdr) - 1 - 4)) { |
509 | cERROR(1, ("Invalid size SMB length %d pdu_length %d", | 506 | cERROR(1, ("Invalid size SMB length %d pdu_length %d", |
510 | length, pdu_length+4)); | 507 | length, pdu_length+4)); |
511 | cifs_reconnect(server); | 508 | cifs_reconnect(server); |
@@ -529,7 +526,7 @@ incomplete_rcv: | |||
529 | total_read += length) { | 526 | total_read += length) { |
530 | length = kernel_recvmsg(csocket, &smb_msg, &iov, 1, | 527 | length = kernel_recvmsg(csocket, &smb_msg, &iov, 1, |
531 | pdu_length - total_read, 0); | 528 | pdu_length - total_read, 0); |
532 | if ( kthread_should_stop() || | 529 | if (kthread_should_stop() || |
533 | (length == -EINTR)) { | 530 | (length == -EINTR)) { |
534 | /* then will exit */ | 531 | /* then will exit */ |
535 | reconnect = 2; | 532 | reconnect = 2; |
@@ -632,9 +629,9 @@ multi_t2_fnd: | |||
632 | /* Was previous buf put in mpx struct for multi-rsp? */ | 629 | /* Was previous buf put in mpx struct for multi-rsp? */ |
633 | if (!isMultiRsp) { | 630 | if (!isMultiRsp) { |
634 | /* smb buffer will be freed by user thread */ | 631 | /* smb buffer will be freed by user thread */ |
635 | if (isLargeBuf) { | 632 | if (isLargeBuf) |
636 | bigbuf = NULL; | 633 | bigbuf = NULL; |
637 | } else | 634 | else |
638 | smallbuf = NULL; | 635 | smallbuf = NULL; |
639 | } | 636 | } |
640 | wake_up_process(task_to_wake); | 637 | wake_up_process(task_to_wake); |
@@ -703,9 +700,8 @@ multi_t2_fnd: | |||
703 | list_for_each(tmp, &GlobalSMBSessionList) { | 700 | list_for_each(tmp, &GlobalSMBSessionList) { |
704 | ses = list_entry(tmp, struct cifsSesInfo, | 701 | ses = list_entry(tmp, struct cifsSesInfo, |
705 | cifsSessionList); | 702 | cifsSessionList); |
706 | if (ses->server == server) { | 703 | if (ses->server == server) |
707 | ses->status = CifsExiting; | 704 | ses->status = CifsExiting; |
708 | } | ||
709 | } | 705 | } |
710 | 706 | ||
711 | spin_lock(&GlobalMid_Lock); | 707 | spin_lock(&GlobalMid_Lock); |
@@ -715,9 +711,8 @@ multi_t2_fnd: | |||
715 | cFYI(1, ("Clearing Mid 0x%x - waking up ", | 711 | cFYI(1, ("Clearing Mid 0x%x - waking up ", |
716 | mid_entry->mid)); | 712 | mid_entry->mid)); |
717 | task_to_wake = mid_entry->tsk; | 713 | task_to_wake = mid_entry->tsk; |
718 | if (task_to_wake) { | 714 | if (task_to_wake) |
719 | wake_up_process(task_to_wake); | 715 | wake_up_process(task_to_wake); |
720 | } | ||
721 | } | 716 | } |
722 | } | 717 | } |
723 | spin_unlock(&GlobalMid_Lock); | 718 | spin_unlock(&GlobalMid_Lock); |
@@ -750,18 +745,15 @@ multi_t2_fnd: | |||
750 | list_for_each(tmp, &GlobalSMBSessionList) { | 745 | list_for_each(tmp, &GlobalSMBSessionList) { |
751 | ses = list_entry(tmp, struct cifsSesInfo, | 746 | ses = list_entry(tmp, struct cifsSesInfo, |
752 | cifsSessionList); | 747 | cifsSessionList); |
753 | if (ses->server == server) { | 748 | if (ses->server == server) |
754 | ses->server = NULL; | 749 | ses->server = NULL; |
755 | } | ||
756 | } | 750 | } |
757 | write_unlock(&GlobalSMBSeslock); | 751 | write_unlock(&GlobalSMBSeslock); |
758 | 752 | ||
759 | kfree(server); | 753 | kfree(server); |
760 | if (length > 0) { | 754 | if (length > 0) |
761 | mempool_resize(cifs_req_poolp, | 755 | mempool_resize(cifs_req_poolp, length + cifs_min_rcv, |
762 | length + cifs_min_rcv, | 756 | GFP_KERNEL); |
763 | GFP_KERNEL); | ||
764 | } | ||
765 | 757 | ||
766 | return 0; | 758 | return 0; |
767 | } | 759 | } |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 916df9431336..b5a9bfff5e50 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -1067,7 +1067,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
1067 | for (i = 0; (i < num_to_fill) && (rc == 0); i++) { | 1067 | for (i = 0; (i < num_to_fill) && (rc == 0); i++) { |
1068 | if (current_entry == NULL) { | 1068 | if (current_entry == NULL) { |
1069 | /* evaluate whether this case is an error */ | 1069 | /* evaluate whether this case is an error */ |
1070 | cERROR(1,("past end of SMB num to fill %d i %d", | 1070 | cERROR(1, ("past SMB end, num to fill %d i %d", |
1071 | num_to_fill, i)); | 1071 | num_to_fill, i)); |
1072 | break; | 1072 | break; |
1073 | } | 1073 | } |
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 892be9b4d1f3..78797c0e076c 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -67,9 +67,8 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB) | |||
67 | pSMB->req.hdr.Flags2 |= SMBFLG2_DFS; | 67 | pSMB->req.hdr.Flags2 |= SMBFLG2_DFS; |
68 | capabilities |= CAP_DFS; | 68 | capabilities |= CAP_DFS; |
69 | } | 69 | } |
70 | if (ses->capabilities & CAP_UNIX) { | 70 | if (ses->capabilities & CAP_UNIX) |
71 | capabilities |= CAP_UNIX; | 71 | capabilities |= CAP_UNIX; |
72 | } | ||
73 | 72 | ||
74 | /* BB check whether to init vcnum BB */ | 73 | /* BB check whether to init vcnum BB */ |
75 | return capabilities; | 74 | return capabilities; |
@@ -203,14 +202,11 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft, | |||
203 | if (len >= words_left) | 202 | if (len >= words_left) |
204 | return rc; | 203 | return rc; |
205 | 204 | ||
206 | if (ses->serverOS) | 205 | kfree(ses->serverOS); |
207 | kfree(ses->serverOS); | ||
208 | /* UTF-8 string will not grow more than four times as big as UCS-16 */ | 206 | /* UTF-8 string will not grow more than four times as big as UCS-16 */ |
209 | ses->serverOS = kzalloc(4 * len, GFP_KERNEL); | 207 | ses->serverOS = kzalloc(4 * len, GFP_KERNEL); |
210 | if (ses->serverOS != NULL) { | 208 | if (ses->serverOS != NULL) |
211 | cifs_strfromUCS_le(ses->serverOS, (__le16 *)data, len, | 209 | cifs_strfromUCS_le(ses->serverOS, (__le16 *)data, len, nls_cp); |
212 | nls_cp); | ||
213 | } | ||
214 | data += 2 * (len + 1); | 210 | data += 2 * (len + 1); |
215 | words_left -= len + 1; | 211 | words_left -= len + 1; |
216 | 212 | ||
@@ -220,8 +216,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft, | |||
220 | if (len >= words_left) | 216 | if (len >= words_left) |
221 | return rc; | 217 | return rc; |
222 | 218 | ||
223 | if (ses->serverNOS) | 219 | kfree(ses->serverNOS); |
224 | kfree(ses->serverNOS); | ||
225 | ses->serverNOS = kzalloc(4 * len, GFP_KERNEL); /* BB this is wrong length FIXME BB */ | 220 | ses->serverNOS = kzalloc(4 * len, GFP_KERNEL); /* BB this is wrong length FIXME BB */ |
226 | if (ses->serverNOS != NULL) { | 221 | if (ses->serverNOS != NULL) { |
227 | cifs_strfromUCS_le(ses->serverNOS, (__le16 *)data, len, | 222 | cifs_strfromUCS_le(ses->serverNOS, (__le16 *)data, len, |
@@ -240,8 +235,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft, | |||
240 | if (len > words_left) | 235 | if (len > words_left) |
241 | return rc; | 236 | return rc; |
242 | 237 | ||
243 | if (ses->serverDomain) | 238 | kfree(ses->serverDomain); |
244 | kfree(ses->serverDomain); | ||
245 | ses->serverDomain = kzalloc(2 * (len + 1), GFP_KERNEL); /* BB FIXME wrong length */ | 239 | ses->serverDomain = kzalloc(2 * (len + 1), GFP_KERNEL); /* BB FIXME wrong length */ |
246 | if (ses->serverDomain != NULL) { | 240 | if (ses->serverDomain != NULL) { |
247 | cifs_strfromUCS_le(ses->serverDomain, (__le16 *)data, len, | 241 | cifs_strfromUCS_le(ses->serverDomain, (__le16 *)data, len, |
@@ -271,8 +265,7 @@ static int decode_ascii_ssetup(char **pbcc_area, int bleft, | |||
271 | if (len >= bleft) | 265 | if (len >= bleft) |
272 | return rc; | 266 | return rc; |
273 | 267 | ||
274 | if (ses->serverOS) | 268 | kfree(ses->serverOS); |
275 | kfree(ses->serverOS); | ||
276 | 269 | ||
277 | ses->serverOS = kzalloc(len + 1, GFP_KERNEL); | 270 | ses->serverOS = kzalloc(len + 1, GFP_KERNEL); |
278 | if (ses->serverOS) | 271 | if (ses->serverOS) |
@@ -289,8 +282,7 @@ static int decode_ascii_ssetup(char **pbcc_area, int bleft, | |||
289 | if (len >= bleft) | 282 | if (len >= bleft) |
290 | return rc; | 283 | return rc; |
291 | 284 | ||
292 | if (ses->serverNOS) | 285 | kfree(ses->serverNOS); |
293 | kfree(ses->serverNOS); | ||
294 | 286 | ||
295 | ses->serverNOS = kzalloc(len + 1, GFP_KERNEL); | 287 | ses->serverNOS = kzalloc(len + 1, GFP_KERNEL); |
296 | if (ses->serverNOS) | 288 | if (ses->serverNOS) |
@@ -479,7 +471,8 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time, | |||
479 | if (ses->capabilities & CAP_UNICODE) { | 471 | if (ses->capabilities & CAP_UNICODE) { |
480 | if (iov[0].iov_len % 2) { | 472 | if (iov[0].iov_len % 2) { |
481 | *bcc_ptr = 0; | 473 | *bcc_ptr = 0; |
482 | } bcc_ptr++; | 474 | bcc_ptr++; |
475 | } | ||
483 | unicode_ssetup_strings(&bcc_ptr, ses, nls_cp); | 476 | unicode_ssetup_strings(&bcc_ptr, ses, nls_cp); |
484 | } else | 477 | } else |
485 | ascii_ssetup_strings(&bcc_ptr, ses, nls_cp); | 478 | ascii_ssetup_strings(&bcc_ptr, ses, nls_cp); |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 746bc9405db1..6684926bf3d2 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -55,7 +55,7 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct cifsSesInfo *ses) | |||
55 | if (temp == NULL) | 55 | if (temp == NULL) |
56 | return temp; | 56 | return temp; |
57 | else { | 57 | else { |
58 | memset(temp, 0, sizeof (struct mid_q_entry)); | 58 | memset(temp, 0, sizeof(struct mid_q_entry)); |
59 | temp->mid = smb_buffer->Mid; /* always LE */ | 59 | temp->mid = smb_buffer->Mid; /* always LE */ |
60 | temp->pid = current->pid; | 60 | temp->pid = current->pid; |
61 | temp->command = smb_buffer->Command; | 61 | temp->command = smb_buffer->Command; |
@@ -158,7 +158,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer, | |||
158 | iov.iov_len = len; | 158 | iov.iov_len = len; |
159 | 159 | ||
160 | smb_msg.msg_name = sin; | 160 | smb_msg.msg_name = sin; |
161 | smb_msg.msg_namelen = sizeof (struct sockaddr); | 161 | smb_msg.msg_namelen = sizeof(struct sockaddr); |
162 | smb_msg.msg_control = NULL; | 162 | smb_msg.msg_control = NULL; |
163 | smb_msg.msg_controllen = 0; | 163 | smb_msg.msg_controllen = 0; |
164 | smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/ | 164 | smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/ |
@@ -228,7 +228,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec, | |||
228 | return -ENOTSOCK; /* BB eventually add reconnect code here */ | 228 | return -ENOTSOCK; /* BB eventually add reconnect code here */ |
229 | 229 | ||
230 | smb_msg.msg_name = sin; | 230 | smb_msg.msg_name = sin; |
231 | smb_msg.msg_namelen = sizeof (struct sockaddr); | 231 | smb_msg.msg_namelen = sizeof(struct sockaddr); |
232 | smb_msg.msg_control = NULL; | 232 | smb_msg.msg_control = NULL; |
233 | smb_msg.msg_controllen = 0; | 233 | smb_msg.msg_controllen = 0; |
234 | smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/ | 234 | smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/ |
@@ -363,9 +363,8 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf, | |||
363 | } /* else ok - we are setting up session */ | 363 | } /* else ok - we are setting up session */ |
364 | } | 364 | } |
365 | *ppmidQ = AllocMidQEntry(in_buf, ses); | 365 | *ppmidQ = AllocMidQEntry(in_buf, ses); |
366 | if (*ppmidQ == NULL) { | 366 | if (*ppmidQ == NULL) |
367 | return -ENOMEM; | 367 | return -ENOMEM; |
368 | } | ||
369 | return 0; | 368 | return 0; |
370 | } | 369 | } |
371 | 370 | ||
@@ -572,9 +571,8 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
572 | rc = map_smb_to_linux_error(midQ->resp_buf); | 571 | rc = map_smb_to_linux_error(midQ->resp_buf); |
573 | 572 | ||
574 | /* convert ByteCount if necessary */ | 573 | /* convert ByteCount if necessary */ |
575 | if (receive_len >= | 574 | if (receive_len >= sizeof(struct smb_hdr) - 4 |
576 | sizeof (struct smb_hdr) - | 575 | /* do not count RFC1001 header */ + |
577 | 4 /* do not count RFC1001 header */ + | ||
578 | (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ ) | 576 | (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ ) |
579 | BCC(midQ->resp_buf) = | 577 | BCC(midQ->resp_buf) = |
580 | le16_to_cpu(BCC_LE(midQ->resp_buf)); | 578 | le16_to_cpu(BCC_LE(midQ->resp_buf)); |
@@ -752,9 +750,8 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
752 | rc = map_smb_to_linux_error(out_buf); | 750 | rc = map_smb_to_linux_error(out_buf); |
753 | 751 | ||
754 | /* convert ByteCount if necessary */ | 752 | /* convert ByteCount if necessary */ |
755 | if (receive_len >= | 753 | if (receive_len >= sizeof(struct smb_hdr) - 4 |
756 | sizeof (struct smb_hdr) - | 754 | /* do not count RFC1001 header */ + |
757 | 4 /* do not count RFC1001 header */ + | ||
758 | (2 * out_buf->WordCount) + 2 /* bcc */ ) | 755 | (2 * out_buf->WordCount) + 2 /* bcc */ ) |
759 | BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); | 756 | BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); |
760 | } else { | 757 | } else { |
@@ -996,9 +993,8 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon, | |||
996 | rc = map_smb_to_linux_error(out_buf); | 993 | rc = map_smb_to_linux_error(out_buf); |
997 | 994 | ||
998 | /* convert ByteCount if necessary */ | 995 | /* convert ByteCount if necessary */ |
999 | if (receive_len >= | 996 | if (receive_len >= sizeof(struct smb_hdr) - 4 |
1000 | sizeof (struct smb_hdr) - | 997 | /* do not count RFC1001 header */ + |
1001 | 4 /* do not count RFC1001 header */ + | ||
1002 | (2 * out_buf->WordCount) + 2 /* bcc */ ) | 998 | (2 * out_buf->WordCount) + 2 /* bcc */ ) |
1003 | BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); | 999 | BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); |
1004 | } else { | 1000 | } else { |